summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2019-01-11 21:26:55 (GMT)
committerGitHub <noreply@github.com>2019-01-11 21:26:55 (GMT)
commitfdf282d609fd172d52b59a6f1f062eb701494528 (patch)
treec73554b9748c06b84b94a84f16fbcca64162b653 /Modules
parenta909460a09cca79bd051c45b02e650862a57dbd9 (diff)
downloadcpython-fdf282d609fd172d52b59a6f1f062eb701494528.zip
cpython-fdf282d609fd172d52b59a6f1f062eb701494528.tar.gz
cpython-fdf282d609fd172d52b59a6f1f062eb701494528.tar.bz2
bpo-35423: Stop using the "pending calls" machinery for signals. (gh-10972)
This change separates the signal handling trigger in the eval loop from the "pending calls" machinery. There is no semantic change and the difference in performance is insignificant. The change makes both components less confusing. It also eliminates the risk of changes to the pending calls affecting signal handling. This is particularly relevant for some upcoming pending calls changes I have in the works.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/signalmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 4f8f71a..9d49cbd 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -202,12 +202,15 @@ It raises KeyboardInterrupt.");
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);
PyErr_SetFromErrno(PyExc_OSError);
PySys_WriteStderr("Exception ignored when trying to write to the "
"signal wakeup fd:\n");
PyErr_WriteUnraisable(NULL);
+ PyErr_Restore(exc, val, tb);
errno = save_errno;
return 0;
}
@@ -216,6 +219,8 @@ report_wakeup_write_error(void *data)
static int
report_wakeup_send_error(void* 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 */
@@ -223,6 +228,7 @@ report_wakeup_send_error(void* data)
PySys_WriteStderr("Exception ignored when trying to send to the "
"signal wakeup fd:\n");
PyErr_WriteUnraisable(NULL);
+ PyErr_Restore(exc, val, tb);
return 0;
}
#endif /* MS_WINDOWS */