mirror of
https://github.com/python/cpython.git
synced 2025-08-28 04:35:02 +00:00
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.
This commit is contained in:
parent
804cdca7ea
commit
009afb7c90
3 changed files with 13 additions and 1 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue