[Python-checkins] cpython (2.7): don't index outside of the path (closes #22312)
benjamin.peterson
python-checkins at python.org
Sun Aug 31 15:34:25 CEST 2014
http://hg.python.org/cpython/rev/446d4dfcc220
changeset: 92281:446d4dfcc220
branch: 2.7
parent: 92274:59f2edeb8443
user: Benjamin Peterson <benjamin at python.org>
date: Sun Aug 31 09:34:09 2014 -0400
summary:
don't index outside of the path (closes #22312)
files:
Lib/ntpath.py | 2 +-
Lib/test/test_ntpath.py | 1 +
Misc/NEWS | 2 ++
3 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -113,7 +113,7 @@
"""
if len(p) > 1:
normp = p.replace(altsep, sep)
- if (normp[0:2] == sep*2) and (normp[2] != sep):
+ if (normp[0:2] == sep*2) and (normp[2:3] != sep):
# is a UNC path:
# vvvvvvvvvvvvvvvvvvvv drive letter or UNC path
# \\machine\mountpoint\directory\etc\...
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -50,6 +50,7 @@
# Issue #19911: UNC part containing U+0130
self.assertEqual(ntpath.splitdrive(u'//conky/MOUNTPOİNT/foo/bar'),
(u'//conky/MOUNTPOİNT', '/foo/bar'))
+ self.assertEqual(ntpath.splitdrive("//"), ("", "//"))
def test_splitunc(self):
tester('ntpath.splitunc("c:\\foo\\bar")',
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -19,6 +19,8 @@
Library
-------
+- Issue #22312: Fix ntpath.splitdrive IndexError.
+
- Issue #22216: smtplib now resets its state more completely after a quit. The
most obvious consequence of the previous behavior was a STARTTLS failure
during a connect/starttls/quit/connect/starttls sequence.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list