STINNER Victor <[email protected]> added the comment:
test_zip_leak2.py: simplified example to trigger the GC issue.
Copy it to Lib/test/ and reproduce the leak with:
./python -m test -R 3:3 test_zip_leak2
Extract of the code:
---
container = []
iterator = zip([container], [container])
# untrack the internal zip->result=(None, None)
gc.collect()
# create a reference cycle: container -> iterator -> container
container.append(iterator)
next(iterator)
# zip->result=(container, container)
del container, iterator
# Try to break the reference cycle
gc.collect()
---
----------
Added file: https://bugs.python.org/file49651/test_zip_leak2.py
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42536>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com