[Python-checkins] cpython (merge 3.4 -> default): Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
serhiy.storchaka
python-checkins at python.org
Wed Mar 25 15:41:59 CET 2015
https://hg.python.org/cpython/rev/16e6515c9476
changeset: 95203:16e6515c9476
parent: 95200:b2a8c30d8ddb
parent: 95202:613c4bd1c29c
user: Serhiy Storchaka <storchaka at gmail.com>
date: Wed Mar 25 16:41:15 2015 +0200
summary:
Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
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
@@ -386,7 +386,7 @@
index = path.index(c)
res += c + path[:index + 1]
except ValueError:
- res += path
+ res += c + path
index = pathlen - 1
elif c == percent: # variable or '%'
if path[index + 1:index + 2] == percent:
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
@@ -237,6 +237,7 @@
tester('ntpath.expandvars("%?bar%")', "%?bar%")
tester('ntpath.expandvars("%foo%%bar")', "bar%bar")
tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
+ tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
@unittest.skipUnless(support.FS_NONASCII, 'need support.FS_NONASCII')
def test_expandvars_nonascii(self):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -30,6 +30,8 @@
Library
-------
+- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
+
- Issue #21717: The zipfile.ZipFile.open function now supports 'x' (exclusive
creation) mode.
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list