diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index 76cd85709a63af..c3c43f39a58e85 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -1074,6 +1074,22 @@ 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( + '