bpo-34013: Move the Python 2 hints from the exception constructor to the parser (GH-27392)
(cherry picked from commit ecc3c8e4216958d85385bf2467441c975128f26c)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
diff --git a/Grammar/python.gram b/Grammar/python.gram
index d3b0fd5..70f2de8 100644
--- a/Grammar/python.gram
+++ b/Grammar/python.gram
@@ -849,9 +849,10 @@
| 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"