diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-23 12:17:59 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-23 12:17:59 (GMT) |
commit | dbac1689483ec160bb811792f5a70e09fefd55ec (patch) | |
tree | b3480c2fa406d7e1e10a45faf90fae2af45b9084 /Lib/lib-tk/FixTk.py | |
parent | d352b24b35bcfd0ac01f46686d3e355537c34515 (diff) | |
download | cpython-dbac1689483ec160bb811792f5a70e09fefd55ec.zip cpython-dbac1689483ec160bb811792f5a70e09fefd55ec.tar.gz cpython-dbac1689483ec160bb811792f5a70e09fefd55ec.tar.bz2 |
Merged revisions 78722 via svnmerge from
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.
........
Diffstat (limited to 'Lib/lib-tk/FixTk.py')
-rw-r--r-- | Lib/lib-tk/FixTk.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/lib-tk/FixTk.py b/Lib/lib-tk/FixTk.py index cb60b612..f9eaa8e 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 |