bpo-34013: Move the Python 2 hints from the exception constructor to the parser (GH-27392)

This commit is contained in:
Pablo Galindo Salgado 2021-07-27 21:30:32 +01:00 committed by GitHub
parent 6948964ecf
commit ecc3c8e421
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 224 deletions

View file

@ -848,9 +848,10 @@ expression_without_invalid[expr_ty]:
| disjunction
| lambdef
invalid_legacy_expression:
| a=NAME b=expression_without_invalid {
_PyPegen_check_legacy_stmt(p, a) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, "Missing parentheses in call to '%U'.", a->v.Name.id) : NULL}
| a=NAME b=star_expressions {
_PyPegen_check_legacy_stmt(p, a) ? RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b,
"Missing parentheses in call to '%U'. Did you mean %U(...)?", a->v.Name.id, a->v.Name.id) : NULL}
invalid_expression:
| invalid_legacy_expression
# !(NAME STRING) is not matched so we don't show this error with some invalid string prefixes like: kf"dsfsdf"