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

I rewrote my PR 13515:

* threading.excepthook() now gets a single argument which has multiple 
attributes: (exc_type, exc_value, exc_traceback, thread)

* The default threading.excepthook() implementation in written in C which 
reduces the risk of missing symbol during Python shutdown. There is also a 
simple implementation in Python, for other Python implementations which don't 
want to implement _thread._excepthook() in C.

* New _make_invoke_excepthook() function which handles the gory details for 
daemon threads. It creates a "local namespace" with references to all required 
functons and creates a _invoke_excepthook() function.

* _invoke_excepthook() packs arguments as a C structseq / Python namedtuple 
(depending on the implementation), calls threading.excepthook(). If 
threading.excepthook() raises an exception, sys.excepthook() is called to 
handle it.

--

First I also added a "stderr" argument to the arguments passed to 
threading.excepthook(): sys.stderr, or an old copy of sys.stderr if sys.stderr 
no longer exists or is set to None. But I decided to keep this as an 
implementation detail instead.

----------

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

Reply via email to