bpo-45408: Don't override previous tokenizer errors in the second parser pass (GH-28812)

This commit is contained in:
Pablo Galindo Salgado 2021-10-07 22:33:05 +01:00 committed by GitHub
parent 6811fdaec8
commit 0219017df7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 2 deletions

View file

@ -1075,6 +1075,14 @@ Module(
with self.assertRaisesRegex(ValueError, msg):
ast.literal_eval(node)
def test_literal_eval_syntax_errors(self):
msg = "unexpected character after line continuation character"
with self.assertRaisesRegex(SyntaxError, msg):
ast.literal_eval(r'''
\
(\
\ ''')
def test_bad_integer(self):
# issue13436: Bad error message with invalid numeric values
body = [ast.ImportFrom(module='time',