[New-bugs-announce] [issue7105] weak dict iterators are fragile because of unpredictable GC runs
Antoine Pitrou
report at bugs.python.org
Sun Oct 11 19:29:26 CEST 2009
New submission from Antoine Pitrou <pitrou at free.fr>:
As mentioned in issue7060, weak dict iterators are easily broken by
cyclic garbage collection changing the size of the underlying dict storage:
File "/home/rdmurray/python/py3k/Lib/weakref.py", line 121, in items
for wr in self.data.values():
RuntimeError: dictionary changed size during iteration
One possible solution is to delay all removals until all iterators are
done. Here is a context manager-based solution.
----------
components: Library (Lib)
files: weakiter.patch
keywords: patch
messages: 93863
nosy: pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: weak dict iterators are fragile because of unpredictable GC runs
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file15103/weakiter.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7105>
_______________________________________
More information about the New-bugs-announce
mailing list