[issue43008] IDLE ignores sys.excepthook in normal, subprocess mode

Terry J. Reedy report at bugs.python.org
Sat Jan 23 12:09:40 EST 2021


Terry J. Reedy <tjreedy at udel.edu> added the comment:

Ken: I will probably work on tests, perhaps as a followup or parallel issue.  I will likely do a bit or refactoring to make testing easier.

I just looked at print_exception and discovered that the double traceback can likely by handled by properly setting exc.context for the 2nd exception.  But getting that right will be aided by having something that already works.

Possible manual test protocol in Shell

>>> import sys
>>> def egood(a,b,c): print('Exception traceback', file=sys.stderr)

>>> sys.excepthook = egood
>>> 1/0
# "Exception traceback"
>>> def ebad(a,b,c): z

>>> sys.excepthook = ebad
>>> 1/0
# Double traceback for ZeroDivisionError and NameError

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43008>
_______________________________________


More information about the Python-bugs-list mailing list