-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
gh-121804: always show error location for SyntaxError's in new repl #121886
gh-121804: always show error location for SyntaxError's in new repl #121886
Conversation
…repl >>> def good(x, y): ... ... def bad(x, x): ... File "<python-input-13>", line 2 def bad(x, x): ... ^ SyntaxError: duplicate argument 'x' in function definition
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.
I presume that this will be backported to 3.13. I would like the pyshell addition backported to 3.12 since I showsyntaxerror needs revision. If you don't, I will.
I'm not sure that referenced issue is important enough to do backport. The #121804 is not specific for the new repl. It's valid for the basic repl as well, long before 3.12.
I doubt it does make sense. Support for kwargs was silently added for showsyntaxerror() in #119318, it's not backported to 3.12. But in 3.13+, probably subclasses of InteractiveInterpreter should be adjusted to accept kwargs. This patch doesn't fix anything for IDLE, apart from this small incompatibility in interfaces. The referenced issue isn't valid for the IDLE - here always correct error locations are highlighted. |
@@ -0,0 +1,3 @@ | |||
Add new kwarg ``source`` for |
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.
We don't want to make this argument public so let's not mention it in the change log . Instead, mention what we are fixing in the repl
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.
Maybe I should make it underscore-prefixed?
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.
Our experience is that if it appears in the signature, people will use it and then changing it will be more challenging. Also some times the underscore prefixed argument is used to avoid collision with keywords or other reserved identifiers.
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.
Our experience is that if it appears in the signature, people will use it and then changing it will be more challenging.
Yeah, I did a proposal to hide this per default: https://discuss.python.org/t/25543.
Also some times the underscore prefixed argument is used to avoid collision with keywords
I was thinking that it's pep8 violation. "it is generally better to append a single trailing underscore rather than use an abbreviation or spelling corruption." (c)
Thanks @skirpichev for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @skirpichev and @pablogsal, I could not cleanly backport this to
|
Thanks a lot for your contribution @skirpichev 🚀 |
Seems the backport failed, do you mind following these instructions to open the 3.13 backport? |
On Mon, Aug 19, 2024 at 07:20:21AM -0700, Pablo Galindo Salgado wrote:
Sorry, ***@***.*** and ***@***.***, I could not cleanly backport
this to 3.13 due to a conflict. Please backport using [3]cherry_picker
on command line.
cherry_picker 354d55e 3.13
Seems the backport failed, do you mind following these instructions to
open the 3.13 backport?
Yes, I'll work on this if you think that issue worth fixing for 3.13.
|
…in new repl (pythonGH-121886) (cherry picked from commit 354d55e) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
GH-123148 is a backport of this pull request to the 3.13 branch. |
GH-123366 is a backport of this pull request to the 3.12 branch. |
SyntaxError
is raised #121804Notes:
showsyntaxerror() has undocumented; newcolorize
kwargsource
argument also left undocumented