[New-bugs-announce] [issue41640] module zipfile issue on closing

Bastian Ebeling report at bugs.python.org
Wed Aug 26 03:31:32 EDT 2020


New submission from Bastian Ebeling <bastian.ebeling at gmail.com>:

When trying to open an archive and read internal binary streams, for me it occurs, that the file-stream gets closed.
As a code-Snippet:

import zipfile
srcfile=zipfile.ZipFile('file.zip')
a=zipfile.Path(srcfile,"data1.bin").read_bytes()
b=zipfile.Path(srcfile,"data2.bin").read_bytes()

the second call results in the ValueError: seek of closed file

A quick and dirty solution (as an idea) is to change close() for the _SharedFile to run self.close() instead of self._close(findeobj) in the end (somehow around line 772).

Hopefully that helps

----------
messages: 375917
nosy: bastian.ebeling
priority: normal
severity: normal
status: open
title: module zipfile issue on closing
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41640>
_______________________________________


More information about the New-bugs-announce mailing list