From: Victor Stinner Date: Fri, 10 Jun 2011 14:32:54 +0000 (+0200) Subject: Issue #10801: Fix test_unicode_filenames() of test_zipfile X-Git-Tag: v3.1.4~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6eafa2ade22dc687eee78374fa93d4b9ab7a2c1;p=python 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). --- diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index a36b010bd8..ee7524e8e5 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -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()