summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-25 14:41:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-25 14:41:15 (GMT)
commitb20f905f6d52d6839ca2e5b3fd069cf5ccffc429 (patch)
treef0e1f25cbf2819fd32d7ddeac33b8498f5defc4e
parent764fc9bfac84d564c526628974a9bd5edfa5bcab (diff)
parent1b87ae0c910e4bcf652bd45a2c8c62ff11606b47 (diff)
downloadcpython-b20f905f6d52d6839ca2e5b3fd069cf5ccffc429.zip
cpython-b20f905f6d52d6839ca2e5b3fd069cf5ccffc429.tar.gz
cpython-b20f905f6d52d6839ca2e5b3fd069cf5ccffc429.tar.bz2
Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
-rw-r--r--Lib/ntpath.py2
-rw-r--r--Lib/test/test_ntpath.py1
-rw-r--r--Misc/NEWS2
3 files changed, 4 insertions, 1 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index ee1a215..6732aa2 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -386,7 +386,7 @@ def expandvars(path):
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
index c8d84a7..dacddde 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -237,6 +237,7 @@ class TestNtpath(unittest.TestCase):
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
index 6534443..822e3fd 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -30,6 +30,8 @@ Core and Builtins
Library
-------
+- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
+
- Issue #21717: The zipfile.ZipFile.open function now supports 'x' (exclusive
creation) mode.