Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[testing] Clean up Exception handling in threads #119

Open
jan-janssen opened this issue Jul 18, 2023 · 0 comments
Open

[testing] Clean up Exception handling in threads #119

jan-janssen opened this issue Jul 18, 2023 · 0 comments

Comments

@jan-janssen
Copy link
Member

Python implements:

threading.excepthook(args, /)
Handle uncaught exception raised by [Thread.run()](https://docs.python.org/3/library/threading.html#threading.Thread.run).

The args argument has the following attributes:

exc_type: Exception type.
exc_value: Exception value, can be None.
exc_traceback: Exception traceback, can be None.
thread: Thread which raised the exception, can be None.
If exc_type is [SystemExit](https://docs.python.org/3/library/exceptions.html#SystemExit), the exception is silently ignored. Otherwise, the exception is printed out on [sys.stderr](https://docs.python.org/3/library/sys.html#sys.stderr).

If this function raises an exception, [sys.excepthook()](https://docs.python.org/3/library/sys.html#sys.excepthook) is called to handle it.

So most likely this is better than the current RaisingThread implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant