[issue7105] weak dict iterators are fragile because of unpredictable GC runs

Charles-François Natali report at bugs.python.org
Wed Jun 1 10:37:00 EDT 2016


Charles-François Natali added the comment:

Shouldn't the documentation be updated?

https://docs.python.org/3.6/library/weakref.html#weakref.WeakKeyDictionary

Note Caution: Because a WeakKeyDictionary is built on top of a Python dictionary, it must not change size when iterating over it. This can be difficult to ensure for a WeakKeyDictionary because actions performed by the program during iteration may cause items in the dictionary to vanish “by magic” (as a side effect of garbage collection).

----------
nosy: +neologix

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7105>
_______________________________________


More information about the Python-bugs-list mailing list