This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients CyberJacob, Decorater, Matt Groth, ellisj, eric.araujo, lazka, mwh, ncoghlan, pitrou, tiagoaoa, tim.peters, undercoveridiot, vlasovskikh, vstinner
Date 2019-05-25.00:28:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558744099.8.0.678228937481.issue1230540@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-05-25 00:28:19vstinnersetrecipients: + vstinner, mwh, tim.peters, ncoghlan, ellisj, pitrou, tiagoaoa, eric.araujo, undercoveridiot, vlasovskikh, lazka, Decorater, CyberJacob, Matt Groth
2019-05-25 00:28:19vstinnersetmessageid: <1558744099.8.0.678228937481.issue1230540@roundup.psfhosted.org>
2019-05-25 00:28:19vstinnerlinkissue1230540 messages
2019-05-25 00:28:19vstinnercreate