New submission from Stepan Kasal <ka...@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)
messages: 154058
nosy: kasal
priority: normal
severity: normal
status: open
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 <rep...@bugs.python.org>
<http://bugs.python.org/issue14099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to