[New-bugs-announce] [issue14099] zipfile: ZipFile.open() should not reopen the underlying file
report at bugs.python.org
Thu Feb 23 11:46:32 CET 2012
New submission from Stepan Kasal <kasal at ucw.cz>:
When a file inside a zip is open, the underlying zip file is open again.
(Unless the file name is unknown, because the ZipFile object was created with fp only.)
This design is incorrect, insecure, and ineffective:
- the reopen uses the same string as file name, but on unix-like systems that file name may no longer exist, or may point to a different file
- opening n files from the same zip archive consumes n OS file descriptors, wasting resources
I believe that the parent ZipFile object and all the child ZipExtFile objects should keep the same fp. The last one would close it.
I'm working on a patch currently.
components: Library (Lib)
title: zipfile: ZipFile.open() should not reopen the underlying file
type: resource usage
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce