bpo-40334: Fix error location upon parsing an invalid string literal (GH-19962)

When parsing a string with an invalid escape, the old parser used to
point to the beginning of the invalid string. This commit changes the new
parser to match that behaviour, since it's currently pointing to the
end of the string (or to be more precise, to the beginning of the next
token).
This commit is contained in:
Lysandros Nikolaou 2020-05-07 13:37:51 +03:00 committed by GitHub
parent 3466922320
commit 2f37c355ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 28 deletions

View file

@ -648,7 +648,7 @@ class CmdLineTest(unittest.TestCase):
self.assertEqual(
stderr.splitlines()[-3:],
[ b' foo = """\\q"""',
b' ^',
b' ^',
b'SyntaxError: invalid escape sequence \\q'
],
)