summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS.d/next/Library/2017-11-03-19-11-43.bpo-30057.NCaijI.rst1
-rw-r--r--Modules/signalmodule.c5
3 files changed, 6 insertions, 1 deletions
diff --git a/Misc/ACKS b/Misc/ACKS
index 667f447..5f21c4b 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -358,6 +358,7 @@ Vincent Delft
Arnaud Delobelle
Konrad Delong
Erik Demaine
+Jeroen Demeyer
Martin Dengler
John Dennis
L. Peter Deutsch
diff --git a/Misc/NEWS.d/next/Library/2017-11-03-19-11-43.bpo-30057.NCaijI.rst b/Misc/NEWS.d/next/Library/2017-11-03-19-11-43.bpo-30057.NCaijI.rst
new file mode 100644
index 0000000..5740eb2
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2017-11-03-19-11-43.bpo-30057.NCaijI.rst
@@ -0,0 +1 @@
+Fix potential missed signal in signal.signal().
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 0e6099f..0b9e8f1 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -462,12 +462,15 @@ signal_signal_impl(PyObject *module, int signalnum, PyObject *handler)
}
else
func = signal_handler;
+ /* Check for pending signals before changing signal handler */
+ if (PyErr_CheckSignals()) {
+ return NULL;
+ }
if (PyOS_setsig(signalnum, func) == SIG_ERR) {
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
old_handler = Handlers[signalnum].func;
- _Py_atomic_store_relaxed(&Handlers[signalnum].tripped, 0);
Py_INCREF(handler);
Handlers[signalnum].func = handler;
if (old_handler != NULL)