summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-06 11:01:08 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-06 11:01:08 (GMT)
commit0b9a18a42fdd9709ac6028e618c8b7f4f0ff4202 (patch)
tree67dbba2d71193f81b1c07b22d95f342cc4302ac3 /Lib
parentaa90db947777d7534eb47f5b3184e87d0901fc63 (diff)
downloadcpython-0b9a18a42fdd9709ac6028e618c8b7f4f0ff4202.zip
cpython-0b9a18a42fdd9709ac6028e618c8b7f4f0ff4202.tar.gz
cpython-0b9a18a42fdd9709ac6028e618c8b7f4f0ff4202.tar.bz2
#6906: TCL_LIBRARY and TK_LIBRARY environment variables should be encoded.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/lib-tk/FixTk.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/lib-tk/FixTk.py b/Lib/lib-tk/FixTk.py
index 638a94c..0d0966c 100644
--- a/Lib/lib-tk/FixTk.py
+++ b/Lib/lib-tk/FixTk.py
@@ -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