[Python-checkins] r81704 - in python/branches/release31-maint: Lib/test/test_tcl.py Lib/tkinter/_fix.py Misc/NEWS

martin.v.loewis python-checkins at python.org
Fri Jun 4 21:51:05 CEST 2010


Author: martin.v.loewis
Date: Fri Jun  4 21:51:05 2010
New Revision: 81704

Log:
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.
  ........
................


Modified:
   python/branches/release31-maint/   (props changed)
   python/branches/release31-maint/Lib/test/test_tcl.py
   python/branches/release31-maint/Lib/tkinter/_fix.py
   python/branches/release31-maint/Misc/NEWS

Modified: python/branches/release31-maint/Lib/test/test_tcl.py
==============================================================================
--- python/branches/release31-maint/Lib/test/test_tcl.py	(original)
+++ python/branches/release31-maint/Lib/test/test_tcl.py	Fri Jun  4 21:51:05 2010
@@ -127,6 +127,31 @@
         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)

Modified: python/branches/release31-maint/Lib/tkinter/_fix.py
==============================================================================
--- python/branches/release31-maint/Lib/tkinter/_fix.py	(original)
+++ python/branches/release31-maint/Lib/tkinter/_fix.py	Fri Jun  4 21:51:05 2010
@@ -42,6 +42,8 @@
         # Ignore leading \\?\
         if s.startswith("\\\\?\\"):
             s = s[4:]
+        if s.startswith("UNC"):
+            s = "\\" + s[3:]
         return s
 
 prefix = os.path.join(sys.prefix,"tcl")

Modified: python/branches/release31-maint/Misc/NEWS
==============================================================================
--- python/branches/release31-maint/Misc/NEWS	(original)
+++ python/branches/release31-maint/Misc/NEWS	Fri Jun  4 21:51:05 2010
@@ -54,6 +54,8 @@
 Library
 -------
 
+- Issue #6470: Drop UNC prefix in FixTk.
+
 - Issue #4768: base64 encoded email body parts were incorrectly stored as
   binary strings.  They are now correctly converted to strings.
 


More information about the Python-checkins mailing list