File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -400,7 +400,7 @@ def expandvars(path):
400400 index = path .index (c )
401401 res += c + path [:index + 1 ]
402402 except ValueError :
403- res += path
403+ res += c + path
404404 index = pathlen - 1
405405 elif c == percent : # variable or '%'
406406 if path [index + 1 :index + 2 ] == percent :
Original file line number Diff line number Diff line change @@ -237,6 +237,7 @@ def test_expandvars(self):
237237 tester ('ntpath.expandvars("%?bar%")' , "%?bar%" )
238238 tester ('ntpath.expandvars("%foo%%bar")' , "bar%bar" )
239239 tester ('ntpath.expandvars("\' %foo%\' %bar")' , "\' %foo%\' %bar" )
240+ tester ('ntpath.expandvars("bar\' %foo%")' , "bar\' %foo%" )
240241
241242 @unittest .skipUnless (support .FS_NONASCII , 'need support.FS_NONASCII' )
242243 def test_expandvars_nonascii (self ):
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ Core and Builtins
1818Library
1919-------
2020
21+ - Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
22+
2123- Issue #21802: The reader in BufferedRWPair now is closed even when closing
2224 writer failed in BufferedRWPair.close().
2325
You can’t perform that action at this time.
0 commit comments