]> granicus.if.org Git - python/commitdiff
Merged revisions 78722 via svnmerge from
authorFlorent Xicluna <florent.xicluna@gmail.com>
Tue, 23 Mar 2010 12:17:59 +0000 (12:17 +0000)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Tue, 23 Mar 2010 12:17:59 +0000 (12:17 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78722 | florent.xicluna | 2010-03-06 12:01:08 +0100 (sam, 06 mar 2010) | 2 lines

  #6906: TCL_LIBRARY and TK_LIBRARY environment variables should be encoded.
........

Lib/lib-tk/FixTk.py
Misc/NEWS

index cb60b6125c28e9f878947dbb5a320a66867a5537..f9eaa8e800de0935ae6b915953b77005ad77cf08 100644 (file)
@@ -19,10 +19,10 @@ except (ImportError, AttributeError):
         return s
 else:
     def convert_path(s):
-        if isinstance(s, str):
-            s = s.decode("mbcs")
+        assert isinstance(s, str)   # sys.prefix contains only bytes
+        udir = s.decode("mbcs")
         hdir = ctypes.windll.kernel32.\
-            CreateFileW(s, 0x80,    # FILE_READ_ATTRIBUTES
+            CreateFileW(udir, 0x80, # FILE_READ_ATTRIBUTES
                         1,          # FILE_SHARE_READ
                         None, 3,    # OPEN_EXISTING
                         0x02000000, # FILE_FLAG_BACKUP_SEMANTICS
@@ -38,9 +38,9 @@ else:
         if res == 0:
             # Conversion failed (e.g. network location)
             return s
-        s = buf[:res]
+        s = buf[:res].encode("mbcs")
         # Ignore leading \\?\
-        if s.startswith(u"\\\\?\\"):
+        if s.startswith("\\\\?\\"):
             s = s[4:]
         return s
 
index e1411df41f64c3d225039b00a664bab5875e8672..9dfb8049d3d1f3b8b983268e63248dcabe791c88 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -36,6 +36,8 @@ Library
   set to an non existent program name and Python is unable to retrieve the real
   program name
 
+- Issue #6906: Tk should not set Unicode environment variables on Windows.
+
 - Issue #1054943: Fix unicodedata.normalize('NFC', text) for the Public Review
   Issue #29