Bug #1196315: fix weakref.WeakValueDictionary constructor.

This commit is contained in:
Georg Brandl 2005-06-04 09:20:03 +00:00
parent 4c560ea05b
commit 9166e1a24a
2 changed files with 3 additions and 1 deletions

View file

@ -43,12 +43,12 @@ class WeakValueDictionary(UserDict.UserDict):
# way in). # way in).
def __init__(self, *args, **kw): def __init__(self, *args, **kw):
UserDict.UserDict.__init__(self, *args, **kw)
def remove(wr, selfref=ref(self)): def remove(wr, selfref=ref(self)):
self = selfref() self = selfref()
if self is not None: if self is not None:
del self.data[wr.key] del self.data[wr.key]
self._remove = remove self._remove = remove
UserDict.UserDict.__init__(self, *args, **kw)
def __getitem__(self, key): def __getitem__(self, key):
o = self.data[key]() o = self.data[key]()

View file

@ -141,6 +141,8 @@ Extension Modules
Library Library
------- -------
- Bug #1196315: fix weakref.WeakValueDictionary constructor.
- Bug #1213894: os.path.realpath didn't resolve symlinks that were the first - Bug #1213894: os.path.realpath didn't resolve symlinks that were the first
component of the path. component of the path.