-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
bpo-34013: Move the Python 2 hints from the exception constructor to the parser #27392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
CC: @ammaraskar this was the PR I had prepared. If you want, we could explore incorporate your suggestions here |
My thinking for suggesting |
I am a bit skeptical but I trust your juzguement. I have updated the PR with the changes you propose :) |
_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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do the carets for this end up? If they're at the end of the expression, LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> print a+b, c+d, f()
File "<stdin>", line 1
print a+b, c+d, f()
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
>>> 3,4 , [print 3+4, 6+7, 8], 34
File "<stdin>", line 1
3,4 , [print 3+4, 6+7, 8], 34
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
>>> print {3+4, 6+7, 8}, 45, 6
File "<stdin>", line 1
print {3+4, 6+7, 8}, 45, 6
^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
>>> (print {3+4, 6+7, 8}, 45, 6), 5
File "<stdin>", line 1
(print {3+4, 6+7, 8}, 45, 6), 5
^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perfect 👌
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10. |
GH-27393 is a backport of this pull request to the 3.10 branch. |
…the parser (pythonGH-27392) (cherry picked from commit ecc3c8e) Co-authored-by: Pablo Galindo Salgado <[email protected]>
…the parser (GH-27392) (cherry picked from commit ecc3c8e) Co-authored-by: Pablo Galindo Salgado <[email protected]>
https://bugs.python.org/issue34013