Skip to content

The new REPL outputs different tracebeck when custom sys.excepthook is used #122478

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

If sys.systemhook is not sys.__systemhook__, the new REPL outputs the line in the code module in the traceback:

>>> xxx
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    xxx
NameError: name 'xxx' is not defined
>>> import sys; sys.excepthook = lambda *args: sys.__excepthook__(*args)
>>> xxx
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/code.py", line 91, in runcode
    exec(code, self.locals)
    ~~~~^^^^^^^^^^^^^^^^^^^
  File "<python-input-2>", line 1, in <module>
    xxx
NameError: name 'xxx' is not defined

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions