summaryrefslogtreecommitdiffstats
path: root/Lib/weakref.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-06-10 20:00:52 (GMT)
committerGuido van Rossum <guido@python.org>2002-06-10 20:00:52 (GMT)
commit009afb7c90882ee83e196b62b1555067e14fd950 (patch)
treecfba62798e8602a7c721f81572ad5df2f1ad9a12 /Lib/weakref.py
parent804cdca7ea38e197e8ac6a9a748a25dc19543079 (diff)
downloadcpython-009afb7c90882ee83e196b62b1555067e14fd950.zip
cpython-009afb7c90882ee83e196b62b1555067e14fd950.tar.gz
cpython-009afb7c90882ee83e196b62b1555067e14fd950.tar.bz2
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.
Diffstat (limited to 'Lib/weakref.py')
-rw-r--r--Lib/weakref.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/weakref.py b/Lib/weakref.py
index 70d36fa..a1fa4e8 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():