diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index 5a35f92cfb6f38..94875d7153f9c5 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -1206,6 +1206,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( + '