[issue16408] zipfile.testzip() opens file but does not close it.
Serhiy Storchaka added the comment: Quite the contrary. The ZipExtFile closes the file descriptor if the ZipFile is constructed on a filename. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16408] zipfile.testzip() opens file but does not close it.
Jesús Cea Avión added the comment: I think this is a duplicate of issue #16183. Are you sure python 3 is affected?. -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16408] zipfile.testzip() opens file but does not close it.
Serhiy Storchaka added the comment: No, this is not a duplicate. ZipExtFile.close() closes a file handle, but ZipExtFile.close() is not used here. I see also some possible FD leaks in ZipFile.open(). It will be good to fix all them in this issue. If no one will make a patch for this easy issue, I'll do it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16408] zipfile.testzip() opens file but does not close it.
Jesús Cea Avión added the comment: Serhiy Storchaka, go for it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16408] zipfile.testzip() opens file but does not close it.
New submission from Eric Busboom: The zipfile.testzip() method will open each of the files in a zip archive, but does not close the files, resulting in a file descriptor leak. -- components: Library (Lib) messages: 174829 nosy: Eric.Busboom priority: normal severity: normal status: open title: zipfile.testzip() opens file but does not close it. type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16408] zipfile.testzip() opens file but does not close it.
Changes by Serhiy Storchaka storch...@gmail.com: -- keywords: +easy stage: - needs patch type: behavior - resource usage versions: +Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16408] zipfile.testzip() opens file but does not close it.
Eric Busboom added the comment: I've tried just closing the ZipExtFile created in testzip, but that didn't actually close the file. It looks like ZipExtClose.close() also doesn't close the file descriptor, at least when the ZipFile is constructed on a filename. This code worked (Addition of f._fileobj.close() ) f = zf.open(zinfo.filename, r) while f.read( 2 ** 20): # Check CRC-32 pass f.close() f._fileobj.close() # This shoulnd't be necessary, but it is. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16408 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com