Skip to content

signalmodule.c uses _PyErr_WriteUnraisableMsg() #98217

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

Merged
merged 1 commit into from
Oct 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,8 @@ report_wakeup_write_error(void *data)
errno = (int) (intptr_t) data;
PyErr_Fetch(&exc, &val, &tb);
PyErr_SetFromErrno(PyExc_OSError);
PySys_WriteStderr("Exception ignored when trying to write to the "
"signal wakeup fd:\n");
PyErr_WriteUnraisable(NULL);
_PyErr_WriteUnraisableMsg("when trying to write to the signal wakeup fd",
NULL);
PyErr_Restore(exc, val, tb);
errno = save_errno;
return 0;
Expand All @@ -284,15 +283,15 @@ report_wakeup_write_error(void *data)
static int
report_wakeup_send_error(void* data)
{
int send_errno = (int) (intptr_t) data;

PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
/* PyErr_SetExcFromWindowsErr() invokes FormatMessage() which
recognizes the error codes used by both GetLastError() and
WSAGetLastError */
PyErr_SetExcFromWindowsErr(PyExc_OSError, (int) (intptr_t) data);
PySys_WriteStderr("Exception ignored when trying to send to the "
"signal wakeup fd:\n");
PyErr_WriteUnraisable(NULL);
PyErr_SetExcFromWindowsErr(PyExc_OSError, send_errno);
_PyErr_WriteUnraisableMsg("when trying to send to the signal wakeup fd", NULL);
PyErr_Restore(exc, val, tb);
return 0;
}
Expand Down