diff options
author | Fred Drake <fdrake@acm.org> | 2001-02-02 15:13:24 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-02-02 15:13:24 (GMT) |
commit | 312a5dc539b583abcbbf006942a4ceead9b9172b (patch) | |
tree | f40b2f79b8cef56306d822062448d73a9b92869e /Lib/weakref.py | |
parent | 261b8e26f199b8e548d9cf81fc4a94820a5a83db (diff) | |
download | cpython-312a5dc539b583abcbbf006942a4ceead9b9172b.zip cpython-312a5dc539b583abcbbf006942a4ceead9b9172b.tar.gz cpython-312a5dc539b583abcbbf006942a4ceead9b9172b.tar.bz2 |
WeakDictionary.items(): Do not allow (key,ref) pairs to leak out for
dead references.
Diffstat (limited to 'Lib/weakref.py')
-rw-r--r-- | Lib/weakref.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/weakref.py b/Lib/weakref.py index f6e07c9..cc7b494 100644 --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -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): |