Commit 53b542fe authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.

parent f95a57f9
......@@ -351,7 +351,7 @@ def expandvars(path):
index = path.index('\'')
res = res + '\'' + path[:index + 1]
except ValueError:
res = res + path
res = res + c + path
index = pathlen - 1
elif c == '%': # variable or '%'
if path[index + 1:index + 2] == '%':
......
......@@ -206,6 +206,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(test_support.FS_NONASCII, 'need test_support.FS_NONASCII')
def test_expandvars_nonascii(self):
......
......@@ -21,6 +21,8 @@ Core and Builtins
Library
-------
- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
- Issue #21802: The reader in BufferedRWPair now is closed even when closing
writer failed in BufferedRWPair.close().
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment