Browse Source
Issue #14159: Fix the len() of weak containers (WeakSet, WeakKeyDictionary, WeakValueDictionary) to return a better approximation when some objects are dead or dying.
Issue #14159: Fix the len() of weak containers (WeakSet, WeakKeyDictionary, WeakValueDictionary) to return a better approximation when some objects are dead or dying.
Moreover, the implementation is now O(1) rather than O(n). Thanks to Yury Selivanov for reporting.pull/2332/head
5 changed files with 115 additions and 3 deletions
-
2Lib/_weakrefset.py
-
60Lib/test/test_weakref.py
-
47Lib/test/test_weakset.py
-
4Lib/weakref.py
-
5Misc/NEWS
Write
Preview
Loading…
Cancel
Save
Reference in new issue