main icon indicating copy to clipboard operation
main copied to clipboard

ZipFile provides no mechanism for closing the underlying file object

Open dxtodorovic opened this issue 11 years ago • 2 comments

When using ZipFile.extractall() method to unpack nested zip files, file operations on underlying files sometimes (almost always) throw an error "The file is used by another process". It appears it has to do with file handles on underlying files not being closed in timely manner (possibly related to issue: 1047).

Similar bug was documented in CPython (http://bugs.python.org/issue9846) and was closed with a proposed fix (issue9846.diff). Upon applying said fix, the issue no longer appeared to happen.

dxtodorovic avatar Aug 27 '15 12:08 dxtodorovic

That CPython issue says it was NOT backported to 2.7 though. I would think we would want to maintain the same (even broken) behavior as CPython in case some code is working around this somehow.

slide avatar Dec 11 '15 12:12 slide

Nevermind, later in the thread it is indeed backported.

slide avatar Dec 18 '15 13:12 slide