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] == '%':
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):
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().