serhiy-storchaka · GitHub

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

Read the original on github.com ↗