Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 342b115

Browse filesBrowse files
authored
signalmodule.c uses _PyErr_WriteUnraisableMsg() (#98217)
Signal wakeup fd errors are now logged with _PyErr_WriteUnraisableMsg(), rather than PySys_WriteStderr() and PyErr_WriteUnraisable(), to pass the error message to sys.unraisablehook. By default, it's still written into stderr (unless sys.unraisablehook is overriden).
1 parent a8c8526 commit 342b115
Copy full SHA for 342b115

File tree

1 file changed

+6
-7
lines changed
Filter options

1 file changed

+6
-7
lines changed

‎Modules/signalmodule.c

Copy file name to clipboardExpand all lines: Modules/signalmodule.c
+6-7Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,8 @@ report_wakeup_write_error(void *data)
272272
errno = (int) (intptr_t) data;
273273
PyErr_Fetch(&exc, &val, &tb);
274274
PyErr_SetFromErrno(PyExc_OSError);
275-
PySys_WriteStderr("Exception ignored when trying to write to the "
276-
"signal wakeup fd:\n");
277-
PyErr_WriteUnraisable(NULL);
275+
_PyErr_WriteUnraisableMsg("when trying to write to the signal wakeup fd",
276+
NULL);
278277
PyErr_Restore(exc, val, tb);
279278
errno = save_errno;
280279
return 0;
@@ -284,15 +283,15 @@ report_wakeup_write_error(void *data)
284283
static int
285284
report_wakeup_send_error(void* data)
286285
{
286+
int send_errno = (int) (intptr_t) data;
287+
287288
PyObject *exc, *val, *tb;
288289
PyErr_Fetch(&exc, &val, &tb);
289290
/* PyErr_SetExcFromWindowsErr() invokes FormatMessage() which
290291
recognizes the error codes used by both GetLastError() and
291292
WSAGetLastError */
292-
PyErr_SetExcFromWindowsErr(PyExc_OSError, (int) (intptr_t) data);
293-
PySys_WriteStderr("Exception ignored when trying to send to the "
294-
"signal wakeup fd:\n");
295-
PyErr_WriteUnraisable(NULL);
293+
PyErr_SetExcFromWindowsErr(PyExc_OSError, send_errno);
294+
_PyErr_WriteUnraisableMsg("when trying to send to the signal wakeup fd", NULL);
296295
PyErr_Restore(exc, val, tb);
297296
return 0;
298297
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.