[issue42536] Iterating on a zip keeps objects alive longer than expected (test_itertools leaks sometimes references)
STINNER Victor
report at bugs.python.org
Wed Dec 2 18:50:25 EST 2020
STINNER Victor <vstinner at python.org> added the comment:
Raymond Hettinger:
> If this is new, pairwise() is the most likely cause.
I reproduced the issue without involving the itertools module. It seems to be a zip_next() micro-optimization which keeps an object alive longer than epxected. This micro-optimization is not new. It's just really hard to trigger the issue.
It seems to depend if the zip object is deleted or not. The builtin zip type implements a traverse function which visits Py_VISIT(lz->result). The GC is supposed to be able to break such cycle, no?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42536>
_______________________________________
More information about the Python-bugs-list
mailing list