From: Michael W. Hudson Date: Fri, 23 Aug 2002 16:29:01 +0000 (+0000) Subject: backport gvanrossum's checkin of X-Git-Tag: v2.2.2b1~195 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4437f2c301307a4b1f6de9d172069601006e6c3a;p=thirdparty%2FPython%2Fcpython.git backport gvanrossum's checkin of revision 1.17 of weakref.py SF patch 564549 (Erik Andersén). The WeakKeyDictionary constructor didn't work when a dict arg was given. Fixed by moving a line. Also adding a unit test. Bugfix candidate. --- diff --git a/Lib/weakref.py b/Lib/weakref.py index 967458d989dc..bc4d0aa3bbfb 100644 --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -144,12 +144,12 @@ class WeakKeyDictionary(UserDict.UserDict): def __init__(self, dict=None): self.data = {} - if dict is not None: self.update(dict) def remove(k, selfref=ref(self)): self = selfref() if self is not None: del self.data[k] self._remove = remove + if dict is not None: self.update(dict) def __delitem__(self, key): for ref in self.data.iterkeys():