Kaydet (Commit) 4437f2c3 authored tarafından Michael W. Hudson's avatar Michael W. Hudson

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.
üst d5fad242
......@@ -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():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment