diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index 76cd85709a63af8..f0209e112beacf7 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -1074,6 +1074,24 @@ def testNotZipFile(self): fp.close() self.assertZipFailure(TESTMOD) + def testInvalidUTF8FileName(self): + # A UTF-8-flagged file name that is not valid UTF-8 raises ZipImportError. + UTF8_FLAG = 0x800 + name = b'\xff\xfe\xff' + cdh = b'PK\x01\x02' + struct.pack( + '