[issue7105] weak dict iterators are fragile because of unpredictable GC runs
Kristján Valur Jónsson
report at bugs.python.org
Tue Nov 19 11:34:59 CET 2013
Kristján Valur Jónsson added the comment:
Yes, the "long iterator" scenario is the reason it is not ideal for this scenario.
The other one (gc.collect()) is easily solved by implementing this construct natively. It can be done rather simply by adding an overriding "pause" property to gc, with the following api:
def pause(increment):
"""
pause or unpause garbage collection. A positive value
increases the pause level, while a negative one reduces it.
when paused, gc won't happen even when explicitly requested with
gc.collect(), until the pause level drops to 0.
"""
I'm sure there are other places in the code with local execution that would benefit from not having an accidental GC run happen. I'm sure I've seen such places, with elaborate scaffolding to safeguard itself from such cases.
Anyway, my 2 aurar worth of lateral thinking applied to the problem at hand :)
What about the patch itself?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7105>
_______________________________________
More information about the Python-bugs-list
mailing list