mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
bpo-41068: Fix read after write in zipfile for non-ASCII files names. (GH-21040)
(cherry picked from commit 36ff513f82
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
5606d555b6
commit
c916c48afc
3 changed files with 8 additions and 1 deletions
|
@ -1600,6 +1600,11 @@ class OtherTests(unittest.TestCase):
|
|||
self.assertEqual(zf.filelist[0].filename, "foo.txt")
|
||||
self.assertEqual(zf.filelist[1].filename, "\xf6.txt")
|
||||
|
||||
def test_read_after_write_unicode_filenames(self):
|
||||
with zipfile.ZipFile(TESTFN2, 'w') as zipfp:
|
||||
zipfp.writestr('приклад', b'sample')
|
||||
self.assertEqual(zipfp.read('приклад'), b'sample')
|
||||
|
||||
def test_exclusive_create_zip_file(self):
|
||||
"""Test exclusive creating a new zipfile."""
|
||||
unlink(TESTFN2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue