Kaydet (Commit) 312a5dc5 authored tarafından Fred Drake's avatar Fred Drake

WeakDictionary.items(): Do not allow (key,ref) pairs to leak out for

    dead references.
üst 261b8e26
...@@ -67,12 +67,12 @@ class WeakDictionary(UserDict.UserDict): ...@@ -67,12 +67,12 @@ class WeakDictionary(UserDict.UserDict):
return o return o
def items(self): def items(self):
L = self.data.items() L = []
for i in range(len(L)): for key, ref in self.data.items():
key, ref = L[i] key, ref = L[i]
o = ref() o = ref()
if o is not None: if o is not None:
L[i] = key, o L.append((key, o))
return L return L
def popitem(self): def popitem(self):
......
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