STINNER Victor <vstin...@redhat.com> added the comment:

> Since the error handling for threading.Thread.run() is written on Python 
> there are many opportunities to get an exception in error handling: 
> KeyboardInterrupt, MemoryError and, at the shutdown stage, maybe NameError, 
> AttributeError or TypeError.

Sure, the risk is real, but I tried to minimize it.

NameError and AttributeError "should" not happen: I wrote 
_make_invoke_excepthook() to prevent name errors. Functions used to invoke 
threading.excepthook are "cached" in a private namespace. Moreover, the default 
hook is implemented in C also to reduce the risk of raising a new exception.

Anyway, if threading.excepthook() raises a second exception, sys.excepthook() 
is now called to handle it ;-) That's a Python 3.8 change. In Python 3.7 and 
older, new exception was handled by start_new_thread().

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37076>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to