Commit c713837e authored by Antoine Pitrou's avatar Antoine Pitrou Committed by GitHub

[2.7] bpo-30057: Fix potential missed signal in signal.signal(). (GH-4258) (#4263)

Bug report and patch by Jeroen Demeyer..
(cherry picked from commit f6f90ff0)
parent b694770a
......@@ -324,6 +324,7 @@ Vincent Delft
Arnaud Delobelle
Konrad Delong
Erik Demaine
Jeroen Demeyer
Martin Dengler
John Dennis
L. Peter Deutsch
......
Fix potential missed signal in signal.signal().
......@@ -317,12 +317,15 @@ signal_signal(PyObject *self, PyObject *args)
}
else
func = signal_handler;
/* Check for pending signals before changing signal handler */
if (PyErr_CheckSignals()) {
return NULL;
}
if (PyOS_setsig(sig_num, func) == SIG_ERR) {
PyErr_SetFromErrno(PyExc_RuntimeError);
return NULL;
}
old_handler = Handlers[sig_num].func;
Handlers[sig_num].tripped = 0;
Py_INCREF(obj);
Handlers[sig_num].func = obj;
if (old_handler != NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment