You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Inconsistency between file names of SyntaxErrors and other Exceptions in the new repl #122546
A small issue, but the new repl reports <unknown> as the file name for SyntaxErrors, but <python-input-x> for other errors:
>>> a b c
File "<unknown>", line 1
a b c
^
SyntaxError: invalid syntax
>>> 1 / 0
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
1 / 0
~~^~~
ZeroDivisionError: division by zero
Classic repl:
>>> a b c
File "<stdin>", line 1
a b c
^
SyntaxError: invalid syntax
>>> a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
a
NameError: name 'a' is not defined
>>>
I think this is because _pyrepl.console.InteractiveColoredConsole.showsyntaxerror does not pass on the filename argument to the super method:
Should probably wait till #122528 is done. Then, InteractiveColoredConsole could be simplified to overwrite only _showtraceback. The undocumented colorize keyword arguments that showtraceback and showsyntaxerror have gained for pyrepl could be removed again.
Activity
pythongh-122546: use same filename for different exceptions in new repl
skirpichev commentedon Aug 22, 2024
pr is ready: #123217
gh-122546: use same filename for different exceptions in new repl (#1…
[3.13] pythongh-122546: use same filename for different exceptions in…
cfbolz commentedon Aug 22, 2024
there's another form of the bug, with
IndentationError, which still shows<unknown>:pythongh-122546: amends 3d7b1a5 (use issubclass)
skirpichev commentedon Aug 22, 2024
Yes, we should use less strict type check. Correction: #123233.
gh-122546: Relax SyntaxError check when raising errors on the new REPL (
[3.13] gh-122546: use same filename for different exceptions in new r…
[3.13] pythongh-122546: Relax SyntaxError check when raising errors o…
pythongh-122546: Relax SyntaxError check when raising errors on the n…
pablogsal commentedon Aug 23, 2024
I think we are done. Please reopen if we missed anything. Thanks @skirpichev for the PRs!
[3.13] gh-122546: Relax SyntaxError check when raising errors on the …