bpo-40267: Fix message when last input character produces a SyntaxError (GH-19521)

When there is a SyntaxError after reading the last input character from
the tokenizer and if no newline follows it, the error message used to be
`unexpected EOF while parsing`, which is wrong.
This commit is contained in:
Lysandros Nikolaou 2020-04-15 21:22:10 +03:00 committed by GitHub
parent 574547a75c
commit 9a4b38f66b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 1 deletions

View file

@ -713,7 +713,7 @@ non-important content
# lambda doesn't work without parens, because the colon
# makes the parser think it's a format_spec
self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing',
self.assertAllRaise(SyntaxError, 'invalid syntax',
["f'{lambda x:x}'",
])