changeset: 95201:9f4d2bdced9c branch: 2.7 parent: 95184:dcf25060cae8 user: Serhiy Storchaka date: Wed Mar 25 16:39:58 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 dcf25060cae8 -r 9f4d2bdced9c Lib/ntpath.py --- a/Lib/ntpath.py Tue Mar 24 23:23:42 2015 +0200 +++ b/Lib/ntpath.py Wed Mar 25 16:39:58 2015 +0200 @@ -351,7 +351,7 @@ 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] == '%': diff -r dcf25060cae8 -r 9f4d2bdced9c Lib/test/test_ntpath.py --- a/Lib/test/test_ntpath.py Tue Mar 24 23:23:42 2015 +0200 +++ b/Lib/test/test_ntpath.py Wed Mar 25 16:39:58 2015 +0200 @@ -206,6 +206,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(test_support.FS_NONASCII, 'need test_support.FS_NONASCII') def test_expandvars_nonascii(self): diff -r dcf25060cae8 -r 9f4d2bdced9c Misc/NEWS --- a/Misc/NEWS Tue Mar 24 23:23:42 2015 +0200 +++ b/Misc/NEWS Wed Mar 25 16:39:58 2015 +0200 @@ -21,6 +21,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().