Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
This commit is contained in:
commit
b20f905f6d
|
@ -386,7 +386,7 @@ def expandvars(path):
|
|||
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:
|
||||
|
|
|
@ -237,6 +237,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(support.FS_NONASCII, 'need support.FS_NONASCII')
|
||||
def test_expandvars_nonascii(self):
|
||||
|
|
Loading…
Reference in New Issue