Commit 0b9a18a4 authored by Florent Xicluna's avatar Florent Xicluna

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

parent aa90db94
...@@ -19,10 +19,10 @@ except (ImportError, AttributeError): ...@@ -19,10 +19,10 @@ except (ImportError, AttributeError):
return s return s
else: else:
def convert_path(s): def convert_path(s):
if isinstance(s, str): assert isinstance(s, str) # sys.prefix contains only bytes
s = s.decode("mbcs") udir = s.decode("mbcs")
hdir = ctypes.windll.kernel32.\ hdir = ctypes.windll.kernel32.\
CreateFileW(s, 0x80, # FILE_READ_ATTRIBUTES CreateFileW(udir, 0x80, # FILE_READ_ATTRIBUTES
1, # FILE_SHARE_READ 1, # FILE_SHARE_READ
None, 3, # OPEN_EXISTING None, 3, # OPEN_EXISTING
0x02000000, # FILE_FLAG_BACKUP_SEMANTICS 0x02000000, # FILE_FLAG_BACKUP_SEMANTICS
...@@ -38,9 +38,9 @@ else: ...@@ -38,9 +38,9 @@ else:
if res == 0: if res == 0:
# Conversion failed (e.g. network location) # Conversion failed (e.g. network location)
return s return s
s = buf[:res] s = buf[:res].encode("mbcs")
# Ignore leading \\?\ # Ignore leading \\?\
if s.startswith(u"\\\\?\\"): if s.startswith("\\\\?\\"):
s = s[4:] s = s[4:]
return s return s
......
...@@ -41,6 +41,8 @@ Core and Builtins ...@@ -41,6 +41,8 @@ Core and Builtins
Library Library
------- -------
- Issue #6906: Tk should not set Unicode environment variables on Windows.
- Issue #1054943: Fix unicodedata.normalize('NFC', text) for the Public Review - Issue #1054943: Fix unicodedata.normalize('NFC', text) for the Public Review
Issue #29 Issue #29
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment