[Python-checkins] cpython (3.1): Issue #10801: Fix test_unicode_filenames() of test_zipfile

victor.stinner python-checkins at python.org
Fri Jun 10 16:35:34 CEST 2011


http://hg.python.org/cpython/rev/33b7428e65b4
changeset:   70757:33b7428e65b4
branch:      3.1
parent:      70644:d4a99fb5c2c5
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Fri Jun 10 16:32:54 2011 +0200
summary:
  Issue #10801: Fix test_unicode_filenames() of test_zipfile

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).

files:
  Lib/test/test_zipfile.py |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py
--- a/Lib/test/test_zipfile.py
+++ b/Lib/test/test_zipfile.py
@@ -405,7 +405,8 @@
 
         zipfp = zipfile.ZipFile(fname)
         try:
-            zipfp.extractall()
+            for name in zipfp.namelist():
+                zipfp.open(name).close()
         finally:
             zipfp.close()
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list