[issue839159] iterators broken for weak dicts

Virgil Dupras report at bugs.python.org
Sun Feb 24 15:25:38 CET 2008


Virgil Dupras added the comment:

I made a patch to fix the problem. The cleaning up of they weakref keys or 
values will be held until all references to iterators created by the 
weakdict are dead.

I also couldn't resist removing code duplication of code in items(), 
keys() and values().

At first, I couldn't understand why this whole remove(), _remove() and 
selfref() mechanism was in place. I had removed them and replaced them 
with methods, and the tests still passed. Then I realized it was to make 
sure keys and values didn't prevent the weak dicts from being freed. I 
added tests for this.

----------
keywords: +patch
nosy: +vdupras
type:  -> behavior
versions: +Python 2.6
Added file: http://bugs.python.org/file9537/weakref_dict_iter.diff

____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue839159>
____________________________________


More information about the Python-bugs-list mailing list