Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Inconsistency between file names of SyntaxErrors and other Exceptions in the new repl #122546

Closed
Labels
3.13bugs and security fixes3.14bugs and security fixestopic-replRelated to the interactive shell
@cfbolz

Description

@cfbolz

A small issue, but the new repl reports<unknown> as the file name forSyntaxErrors, but<python-input-x> for other errors:

>>> a b c  File "<unknown>", line 1    a b c      ^SyntaxError: invalid syntax>>> 1 / 0Traceback (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>>> aTraceback (most recent call last):  File "<stdin>", line 1, in <module>    aNameError: name 'a' is not defined>>>

I think this is because_pyrepl.console.InteractiveColoredConsole.showsyntaxerror does not pass on thefilename 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 thatshowtraceback andshowsyntaxerror have gained for pyrepl could be removed again.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13bugs and security fixes3.14bugs and security fixestopic-replRelated to the interactive shell

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp