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
terryjreedy
left a comment
There was a problem hiding this comment.
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.
| @@ -0,0 +1,3 @@ | |||
| Add new kwarg ``source`` for | |||
There was a problem hiding this comment.
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.
Maybe I should make it underscore-prefixed?
There was a problem hiding this comment.
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.
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. |

SyntaxErroris raised #121804Notes:
showsyntaxerror() has undocumented; newcolorizekwargsourceargument also left undocumented