[issue13133] FD leaks in ZipFile.read(), ZipFile.extract() and also using explicit arc_member.close()

Amaury Forgeot d'Arc report at bugs.python.org
Sat Oct 8 23:58:43 CEST 2011


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

Yes, in 2.7 many parts of the stdlib relies on reference counting to close files.  But 3.2 introduced a ResourceWarning which is emitted (in debug mode) each time a __del__ closes a valuable resource like a file or a socket.  This was done exactly for this reason - help other implementations with a different garbage collector.

Now Lib/zipfile.py is probably much more gc-friendly: see how it uses a new member "close_fileobj", and the "with" statement in ZipFile.read().

PyPy will benefit of this when it migrates to 3.2; meanwhile, you could apply the same changes in pypy's own copy of zipfile.py.

----------
nosy: +amaury.forgeotdarc
resolution:  -> out of date
status: open -> pending

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13133>
_______________________________________


More information about the Python-bugs-list mailing list