]> granicus.if.org Git - python/commitdiff
Issue #10801: Fix test_unicode_filenames() of test_zipfile
authorVictor Stinner <victor.stinner@haypocalc.com>
Fri, 10 Jun 2011 14:32:54 +0000 (16:32 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Fri, 10 Jun 2011 14:32:54 +0000 (16:32 +0200)
Just try to open files from the ZIP for reading, don't extract them to avoid
UnicodeEncodeError if the filename is not encodable to the filesystem encoding
(e.g. ASCII locale encoding).

Lib/test/test_zipfile.py

index a36b010bd882c9ee9ff94fc2226457610a13db4b..ee7524e8e5bcb45cebd6474dcfee61b099afdbf0 100644 (file)
@@ -405,7 +405,8 @@ class TestsWithSourceFile(unittest.TestCase):
 
         zipfp = zipfile.ZipFile(fname)
         try:
-            zipfp.extractall()
+            for name in zipfp.namelist():
+                zipfp.open(name).close()
         finally:
             zipfp.close()