[Python-checkins] cpython (2.7): Fix translating of illegal characters on Windows (issue #6972).

serhiy.storchaka python-checkins at python.org
Sat Feb 2 11:31:31 CET 2013


http://hg.python.org/cpython/rev/c3ab8a698d2f
changeset:   81923:c3ab8a698d2f
branch:      2.7
parent:      81919:706218e0facb
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Feb 02 12:30:49 2013 +0200
summary:
  Fix translating of illegal characters on Windows (issue #6972).

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


diff --git a/Lib/zipfile.py b/Lib/zipfile.py
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -5,6 +5,7 @@
 import binascii, cStringIO, stat
 import io
 import re
+import string
 
 try:
     import zlib # We may need its compression method
@@ -1052,7 +1053,7 @@
         # filter illegal characters on Windows
         if os.path.sep == '\\':
             illegal = ':<>|"?*'
-            table = str.maketrans(illegal, '_' * len(illegal))
+            table = string.maketrans(illegal, '_' * len(illegal))
             arcname = arcname.translate(table)
 
         targetpath = os.path.join(targetpath, arcname)

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


More information about the Python-checkins mailing list