New submission from Joel Croteau <jcrot...@liveramp.com>:

This has been commented on numerous times by others 
(https://stackoverflow.com/questions/2829329/catch-a-threads-exception-in-the-caller-thread-in-python,
 http://benno.id.au/blog/2012/10/06/python-thread-exceptions, to name a few), 
but there is no in-built mechanism in threading to catch an unhandled exception 
thrown by a thread. The default behavior of dumping to stderr is completely 
useless for error handling in many scenarios. Solutions do exist, but I have 
yet to see one that is not exceptionally complicated. It seems like checking 
for exceptions should be a very basic part of any threading library. The 
simplest solution would be to just have the Thread store any unhandled 
exceptions and have them raised by Thread.join(). There could also be 
additional methods to check if exceptions were raised.

----------
components: Library (Lib)
messages: 340520
nosy: Joel Croteau
priority: normal
severity: normal
status: open
title: threading.Thread should have way to catch an exception thrown within
versions: Python 3.7

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

Reply via email to