[issue1230540] sys.excepthook doesn't work in threads

STINNER Victor report at bugs.python.org
Sat May 25 17:09:43 EDT 2019


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

Serhiy Storchaka:
> I propose to add the Thead.excepthook() method with the signature compatible with sys.excepthook(). This will allow to set easily per-thread hooks and a global hook.

I don't see the relationship between the API (signature) and the ability to set a per-thread hook.

I'm not convinced that a per-thread hook is needed. My proposed global threading.excepthook gets a thread parameter which allows a custom hook to implement a different behavior depending on the thread. You can use a different behavior depending on the thread name, depending on a custom Thread attribute, etc.

Would it be acceptable for first add a global hook and see later if a per-thread hook is needed?

----------

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


More information about the Python-bugs-list mailing list