[Python-checkins] CVS: python/dist/src/Lib weakref.py,1.11,1.12
Fred L. Drake
fdrake@users.sourceforge.net
Thu, 06 Sep 2001 07:51:03 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv15927
Modified Files:
weakref.py
Log Message:
Add __delitem__() support for WeakKeyDictionary.
This closes SF bug #458860.
Index: weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** weakref.py 2001/08/03 04:11:27 1.11
--- weakref.py 2001/09/06 14:51:01 1.12
***************
*** 147,150 ****
--- 147,157 ----
self._remove = remove
+ def __delitem__(self, key):
+ for ref in self.data.iterkeys():
+ o = ref()
+ if o == key:
+ del self.data[ref]
+ return
+
def __getitem__(self, key):
return self.data[ref(key)]