[New-bugs-announce] [issue41068] zipfile: read after write fails for non-ascii files
Serhiy Storchaka
report at bugs.python.org
Sun Jun 21 16:08:04 EDT 2020
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
When open a ZIP archive, write a file with non-ascii name in it, and, not closing the archive, read that file back, it fails:
>>> import zipfile
>>> with zipfile.ZipFile('test.zip', 'w') as zf:
... zf.writestr('йцукен', '')
... zf.read('йцукен')
...
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/usr/lib/python3.8/zipfile.py", line 1440, in read
with self.open(name, "r", pwd) as fp:
File "/usr/lib/python3.8/zipfile.py", line 1521, in open
raise BadZipFile(
zipfile.BadZipFile: File name in directory 'йцукен' and header b'\xd0\xb9\xd1\x86\xd1\x83\xd0\xba\xd0\xb5\xd0\xbd' differ.
----------
components: Library (Lib)
messages: 372018
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: zipfile: read after write fails for non-ascii files
type: behavior
versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41068>
_______________________________________
More information about the New-bugs-announce
mailing list