diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2010-06-04 19:39:07 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2010-06-04 19:39:07 (GMT) |
commit | eba67c0eac27cfafb779372ef82de09aefcca262 (patch) | |
tree | 0e5544b9e61e332b677201843970a64b0fc195d1 | |
parent | 16b2a5e0a928bb1d49598aa34bf1bb5db7071863 (diff) | |
download | cpython-eba67c0eac27cfafb779372ef82de09aefcca262.zip cpython-eba67c0eac27cfafb779372ef82de09aefcca262.tar.gz cpython-eba67c0eac27cfafb779372ef82de09aefcca262.tar.bz2 |
Issue #6470: Drop UNC prefix in FixTk.py
Patch by Christop Gohlke and Amaury Forgeot d'Arc.
-rw-r--r-- | Lib/lib-tk/FixTk.py | 2 | ||||
-rw-r--r-- | Lib/test/test_tcl.py | 25 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 29 insertions, 0 deletions
diff --git a/Lib/lib-tk/FixTk.py b/Lib/lib-tk/FixTk.py index 0d0966c..49960c7 100644 --- a/Lib/lib-tk/FixTk.py +++ b/Lib/lib-tk/FixTk.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") diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py index 7057979..1b3c1cc 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(): test_support.run_unittest(TclTest, TkinterTest) @@ -46,6 +46,8 @@ C-API Library ------- +- Issue #6470: Drop UNC prefix in FixTk. + - Issue #5610: feedparser no longer eats extra characters at the end of a body part if the body part ends with a \r\n. |