[Python-checkins] CVS: python/dist/src/Lib weakref.py,1.14,1.15

Fred L. Drake fdrake@users.sourceforge.net
Tue, 06 Nov 2001 08:36:55 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv14499

Modified Files:
	weakref.py 
Log Message:
WeakKeyDictionary.has_key():  If the key being tested is not weakly
referencable (weakref.ref() raises TypeError), return 0 instead of
propogating the TypeError.
This closes SF bug #478536; bugfix candidate.


Index: weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** weakref.py	2001/10/05 21:54:09	1.14
--- weakref.py	2001/11/06 16:36:53	1.15
***************
*** 180,184 ****
  
      def has_key(self, key):
!         return self.data.has_key(ref(key))
  
      def items(self):
--- 180,188 ----
  
      def has_key(self, key):
!         try:
!             wr = ref(key)
!         except TypeError:
!             return 0
!         return self.data.has_key(wr)
  
      def items(self):