bpo-37076: _thread.start_new_thread() calls _PyErr_WriteUnraisableMsg() by vstinner · Pull Request #13617 · python/cpython (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation2 Commits4 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

vstinner

_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

@vstinner

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.

@vstinner

_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.

serhiy-storchaka

@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

@vstinner @DinoV

…() (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.