STINNER Victor <[email protected]> added the comment:
Can't you do that in your own hook? For example:
orig_hook = threading.excepthook
threading.excepthook = myhook
def myhook(args):
try:
...
except:
print("too bad!")
orig_hook(args)
I found one interesting usage of sys.__excepthook__ in
code.InteractiveInterpreter:
if sys.excepthook is sys.__excepthook__:
lines = traceback.format_exception_only(type, value)
self.write(''.join(lines))
else:
# If someone has set sys.excepthook, we let that take precedence
# over self.write
sys.excepthook(type, value, tb)
So it seems like sys.__excepthook__ is useful ;-)
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42308>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com