diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2010-06-04 19:51:05 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2010-06-04 19:51:05 (GMT) |
commit | 7b6b90d448d17fdec8252a642ba78d01b19a3da6 (patch) | |
tree | 8e8c17744d4aa69988d561e0d1959764677ac80a /Lib | |
parent | 9d5c7a5b9d079262c569bae8f5afbaa9afcd069c (diff) | |
download | cpython-7b6b90d448d17fdec8252a642ba78d01b19a3da6.zip cpython-7b6b90d448d17fdec8252a642ba78d01b19a3da6.tar.gz cpython-7b6b90d448d17fdec8252a642ba78d01b19a3da6.tar.bz2 |
Merged revisions 81703 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
................
r81703 | martin.v.loewis | 2010-06-04 21:50:26 +0200 (Fr, 04 Jun 2010) | 10 lines
Merged revisions 81701 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81701 | martin.v.loewis | 2010-06-04 21:39:07 +0200 (Fr, 04 Jun 2010) | 2 lines
Issue #6470: Drop UNC prefix in FixTk.py
Patch by Christop Gohlke and Amaury Forgeot d'Arc.
........
................
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_tcl.py | 25 | ||||
-rw-r--r-- | Lib/tkinter/_fix.py | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index eebdd25..a269db8 100644 --- a/Lib/test/test_tcl.py +++ b/Lib/test/test_tcl.py @@ -127,6 +127,31 @@ class TclTest(unittest.TestCase): tcl = self.interp self.assertRaises(TclError,tcl.eval,'package require DNE') + def testLoadWithUNC(self): + import sys + if sys.platform != 'win32': + return + + # Build a UNC path from the regular path. + # Something like + # \\%COMPUTERNAME%\c$\python27\python.exe + + fullname = os.path.abspath(sys.executable) + if fullname[1] != ':': + return + unc_name = r'\\%s\%s$\%s' % (os.environ['COMPUTERNAME'], + fullname[0], + fullname[3:]) + + with test_support.EnvironmentVarGuard() as env: + env.unset("TCL_LIBRARY") + f = os.popen('%s -c "import Tkinter; print Tkinter"' % (unc_name,)) + + self.assert_('Tkinter.py' in f.read()) + # exit code must be zero + self.assertEqual(f.close(), None) + + def test_main(): support.run_unittest(TclTest, TkinterTest) diff --git a/Lib/tkinter/_fix.py b/Lib/tkinter/_fix.py index c11d663..5a69d89 100644 --- a/Lib/tkinter/_fix.py +++ b/Lib/tkinter/_fix.py @@ -42,6 +42,8 @@ else: # Ignore leading \\?\ if s.startswith("\\\\?\\"): s = s[4:] + if s.startswith("UNC"): + s = "\\" + s[3:] return s prefix = os.path.join(sys.prefix,"tcl") |