[issue37076] _thread.start_new_thread(): call sys.unraisablehook() to handle uncaught exceptions

STINNER Victor report at bugs.python.org
Tue May 28 06:23:15 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

This issue is a follow-up of:

* bpo-36829: Add sys.unraisablehook() to custom how "unraisable exceptions" are logged
* bpo-1230540: Add threading.excepthook() to handle uncaught exceptions raised by Thread.run()


Discussions around _thread.start_new_thead() exception:

Antoine Pitrou:
"""
>From the doc: Handle uncaught :func:``Thread.run`` exception.

What if some C extension wants to report uncaught exceptions in C-created threads? Does it have to create a dummy Thread object?

For example, how about threads created by _thread.start_new_thread?
"""

https://github.com/python/cpython/pull/13515#issuecomment-495935350


Serhiy Storchaka:
"If we want to support low-level threads created by start_new_thread() we should call [threading.]excepthook() from t_bootstrap instead of Thread._bootstrap_inner. Otherwise implementing excepthook() as a Thread method would be more convenient."

https://bugs.python.org/issue1230540#msg343748

----------

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


More information about the Python-bugs-list mailing list