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

bpo-37076: _thread.start_new_thread() calls _PyErr_WriteUnraisableMsg() #13617

Merged
merged 4 commits into from
May 29, 2019
Merged

bpo-37076: _thread.start_new_thread() calls _PyErr_WriteUnraisableMsg() #13617

merged 4 commits into from
May 29, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented May 28, 2019

_thread.start_new_thread() now logs uncaught exception raised by the
function using sys.unraisablehook(), rather than sys.excepthook(), so
the hook gets access to the function which raised the exception.

https://bugs.python.org/issue37076

@vstinner
Copy link
Member Author

See https://bugs.python.org/issue37076 for my choice of sys.unraisablehook() rather than threading.excepthook().

@vstinner
Copy link
Member Author

My PR changes the error message:

Unhandled exception in thread started by {func!r}"
Traceback ...

becomes:

Exception ignored in thread started by: {func!r}"
Traceback ...

Technically, _PyErr_WriteUnraisableMsg() internals would allow to override the whole error message. We chose to hardcode "Exception ignored" prefix. IMHO it's a good thing that error messages are more similar. So changing the error message is a good thing.

_thread.start_new_thread() now logs uncaught exception raised by the
function using sys.unraisablehook(), rather than sys.excepthook(), so
the hook gets access to the function which raised the exception.
@vstinner vstinner merged commit 8b09500 into python:master May 29, 2019
@vstinner vstinner deleted the start_new_thread_hook branch July 15, 2019 11:28
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
…() (pythonGH-13617)

_thread.start_new_thread() now logs uncaught exception raised by the
function using sys.unraisablehook(), rather than sys.excepthook(), so
the hook gets access to the function which raised the exception.
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

Successfully merging this pull request may close these issues.

None yet

4 participants