Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Closed
Copy link
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixestopic-replRelated to the interactive shellRelated to the interactive shell
Description
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:
defshowsyntaxerror(self, filename=None): super().showsyntaxerror(colorize=self.can_colorize)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.
Linked PRs
- gh-122546: use same filename for different exceptions in new repl #123217
- [3.13] gh-122546: use same filename for different exceptions in new repl (GH-123217) #123226
- gh-122546: Relax SyntaxError check when raising errors on the new REPL #123233
- [3.13] gh-122546: Relax SyntaxError check when raising errors on the new REPL (GH-123233) #123246
- [3.13] gh-122546: Relax SyntaxError check when raising errors on the new REPL (GH-123233) #123247
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixestopic-replRelated to the interactive shellRelated to the interactive shell