bpo-1230540: Invoke custom sys.excepthook for threads in threading by vlasovskikh · Pull Request #8610 · python/cpython

Conversation

@vlasovskikh

Threads created via threading.Thread didn't invoke sys.excepthook if there was an uncaught exception. Since the docs for sys.excepthook are not specific about using it from threads and, in fact, this hook works for threads created via the _thread module, it makes sense to enable it the threading module as well.

https://bugs.python.org/issue1230540

Threads created via threading.Thread didn't invoke sys.excepthook if
there was an uncaught exception. Since the docs for sys.excepthook are
not specific about using it from threads and, in fact, this hook works
for threads created via the _thread module, it makes sense to enable it
the threading module as well.

@vstinner

I dislike this PR: threading.Thread doesn't call sys.excepthook to handle run() exception by default, it only calls sys.excepthook if it's overridden. Moreover, when sys.excepthook is called, the hook doesn't get access to the thread object :-(
https://bugs.python.org/issue1230540#msg343260

I proposed a different approach: PR #13515.

@vstinner

I merged a different approach: my PR #13515. Thanks @vlasovskikh anyway for working on this issue ;-)

Labels