changeset: 95202:613c4bd1c29c branch: 3.4 parent: 95190:004e3870d9e6 user: Serhiy Storchaka date: Wed Mar 25 16:40:15 2015 +0200 files: Lib/ntpath.py Lib/test/test_ntpath.py Misc/NEWS description: Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes. diff -r 004e3870d9e6 -r 613c4bd1c29c Lib/ntpath.py --- a/Lib/ntpath.py Wed Mar 25 02:25:25 2015 +0100 +++ b/Lib/ntpath.py Wed Mar 25 16:40:15 2015 +0200 @@ -400,7 +400,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 -r 004e3870d9e6 -r 613c4bd1c29c Lib/test/test_ntpath.py --- a/Lib/test/test_ntpath.py Wed Mar 25 02:25:25 2015 +0100 +++ b/Lib/test/test_ntpath.py Wed Mar 25 16:40:15 2015 +0200 @@ -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 -r 004e3870d9e6 -r 613c4bd1c29c Misc/NEWS --- a/Misc/NEWS Wed Mar 25 02:25:25 2015 +0100 +++ b/Misc/NEWS Wed Mar 25 16:40:15 2015 +0200 @@ -18,6 +18,8 @@ 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().