New submission from Serhiy Storchaka <storchaka+cpyt...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue41068>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to