Skip to content

[testing] Clean up Exception handling in threads #119

Closed
@jan-janssen

Description

@jan-janssen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions