Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7b6b90d

Browse files
committed
Merged revisions 81703 via svnmerge from
svn+ssh://[email protected]/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://[email protected]/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. ........ ................
1 parent 9d5c7a5 commit 7b6b90d

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

Lib/test/test_tcl.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,31 @@ def testPackageRequireException(self):
127127
tcl = self.interp
128128
self.assertRaises(TclError,tcl.eval,'package require DNE')
129129

130+
def testLoadWithUNC(self):
131+
import sys
132+
if sys.platform != 'win32':
133+
return
134+
135+
# Build a UNC path from the regular path.
136+
# Something like
137+
# \\%COMPUTERNAME%\c$\python27\python.exe
138+
139+
fullname = os.path.abspath(sys.executable)
140+
if fullname[1] != ':':
141+
return
142+
unc_name = r'\\%s\%s$\%s' % (os.environ['COMPUTERNAME'],
143+
fullname[0],
144+
fullname[3:])
145+
146+
with test_support.EnvironmentVarGuard() as env:
147+
env.unset("TCL_LIBRARY")
148+
f = os.popen('%s -c "import Tkinter; print Tkinter"' % (unc_name,))
149+
150+
self.assert_('Tkinter.py' in f.read())
151+
# exit code must be zero
152+
self.assertEqual(f.close(), None)
153+
154+
130155

131156
def test_main():
132157
support.run_unittest(TclTest, TkinterTest)

Lib/tkinter/_fix.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def convert_path(s):
4242
# Ignore leading \\?\
4343
if s.startswith("\\\\?\\"):
4444
s = s[4:]
45+
if s.startswith("UNC"):
46+
s = "\\" + s[3:]
4547
return s
4648

4749
prefix = os.path.join(sys.prefix,"tcl")

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ C-API
5454
Library
5555
-------
5656

57+
- Issue #6470: Drop UNC prefix in FixTk.
58+
5759
- Issue #4768: base64 encoded email body parts were incorrectly stored as
5860
binary strings. They are now correctly converted to strings.
5961

0 commit comments

Comments
 (0)