[New-bugs-announce] [issue3680] Cycles with some iterator are leaking.

Robert Schuppenies report at bugs.python.org
Mon Aug 25 22:43:45 CEST 2008

New submission from Robert Schuppenies <robert.schuppenies at gmail.com>:

The dict, set, and deque iterators do not implement tp_traverse although
they reference container objects. This can lead to reference cycles
which will not be collected. The attached cycle.py script from Amaury
demonstrates the problem for dict iterators. The attached patch
addresses the issue for the above mentioned types. The method applied in
the demonstration script was used for test cases.

This is my first excursion into cyclic garbage collector
implementations, so please review carefully. Also, I am not sure about
tp_traverse for the deque type. Must the block member also be considered
or is the deque member sufficient?

Finally, do you consider this a show stopper?

components: Interpreter Core
files: cycle.py
keywords: patch
messages: 71955
nosy: amaury.forgeotdarc, schuppenies
severity: normal
status: open
title: Cycles with some iterator are leaking.
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file11254/cycle.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list