Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Modules/signalmodule.c
  • Loading branch information
iritkatriel committed Feb 23, 2023
commit ca94282b32deecd216adbdf7f4ad5ee017031674
10 changes: 4 additions & 6 deletions Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,13 @@ signal_default_int_handler_impl(PyObject *module, int signalnum,
static int
report_wakeup_write_error(void *data)
{
PyObject *exc, *val, *tb;
int save_errno = errno;
errno = (int) (intptr_t) data;
PyErr_Fetch(&exc, &val, &tb);
PyObject *exc = PyErr_GetRaisedException();
PyErr_SetFromErrno(PyExc_OSError);
_PyErr_WriteUnraisableMsg("when trying to write to the signal wakeup fd",
NULL);
PyErr_Restore(exc, val, tb);
PyErr_SetRaisedException(exc);
errno = save_errno;
return 0;
}
Expand All @@ -252,14 +251,13 @@ report_wakeup_send_error(void* data)
{
int send_errno = (int) (intptr_t) data;

PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
PyObject *exc = PyErr_GetRaisedException();
/* PyErr_SetExcFromWindowsErr() invokes FormatMessage() which
recognizes the error codes used by both GetLastError() and
WSAGetLastError */
PyErr_SetExcFromWindowsErr(PyExc_OSError, send_errno);
_PyErr_WriteUnraisableMsg("when trying to send to the signal wakeup fd", NULL);
PyErr_Restore(exc, val, tb);
PyErr_SetRaisedException(exc);
return 0;
}
#endif /* MS_WINDOWS */
Expand Down