mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
WeakDictionary.items(): Do not allow (key,ref) pairs to leak out for
dead references.
This commit is contained in:
parent
261b8e26f1
commit
312a5dc539
1 changed files with 3 additions and 3 deletions
|
@ -67,12 +67,12 @@ class WeakDictionary(UserDict.UserDict):
|
|||
return o
|
||||
|
||||
def items(self):
|
||||
L = self.data.items()
|
||||
for i in range(len(L)):
|
||||
L = []
|
||||
for key, ref in self.data.items():
|
||||
key, ref = L[i]
|
||||
o = ref()
|
||||
if o is not None:
|
||||
L[i] = key, o
|
||||
L.append((key, o))
|
||||
return L
|
||||
|
||||
def popitem(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue