]> granicus.if.org Git - python/commitdiff
Merged revisions 81701 via svnmerge from
authorMartin v. Löwis <martin@v.loewis.de>
Fri, 4 Jun 2010 19:46:21 +0000 (19:46 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Fri, 4 Jun 2010 19:46:21 +0000 (19:46 +0000)
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.
........

Lib/lib-tk/FixTk.py
Lib/test/test_tcl.py
Misc/NEWS

index f9eaa8e800de0935ae6b915953b77005ad77cf08..375c34c2e532e8bc34f5edf56461baa9005acf54 100644 (file)
@@ -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")
index fa170ef58dd660de756afc47c38ea43a823a1782..6a87ce203f5d85f2ee80f77f256ba0e87162608f 100644 (file)
@@ -150,6 +150,31 @@ class TclTest(unittest.TestCase):
             if old_display is not None:
                 os.environ['DISPLAY'] = old_display
 
+    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)
 
index e4a848edab87c9156e86be2647a4eed0f3b9ceee..2480c8a3f80c11dee2f0f13da5b03c763d2ea498 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -58,6 +58,8 @@ C-API
 Library
 -------
 
+- Issue #6470: Drop UNC prefix in FixTk.
+
 - Issue #8833: tarfile created hard link entries with a size field != 0 by
   mistake.