]> granicus.if.org Git - python/commit
Issue #14159: Fix the len() of weak containers (WeakSet, WeakKeyDictionary, WeakValue...
authorAntoine Pitrou <solipsis@pitrou.net>
Thu, 1 Mar 2012 15:26:35 +0000 (16:26 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Thu, 1 Mar 2012 15:26:35 +0000 (16:26 +0100)
commitbbe2f60b3c19ecaa02ca07be14474eaacfcb59a0
tree768a0d9c5d1402c0d91dcaf9597e83adea6d892a
parenteb977dac9cfd590982d08d1a9f7bae58498648ca
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.
Lib/_weakrefset.py
Lib/test/test_weakref.py
Lib/test/test_weakset.py
Lib/weakref.py
Misc/NEWS