Issue #14173: Avoid crashing when reading a signal handler during interpreter shutdown.
This commit is contained in:
commit
52c5f85cf9
|
@ -69,6 +69,9 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #14173: Avoid crashing when reading a signal handler during
|
||||
interpreter shutdown.
|
||||
|
||||
- Issue #15902: Fix imp.load_module() accepting None as a file when loading an
|
||||
extension module.
|
||||
|
||||
|
|
|
@ -339,7 +339,10 @@ signal_signal(PyObject *self, PyObject *args)
|
|||
Handlers[sig_num].tripped = 0;
|
||||
Py_INCREF(obj);
|
||||
Handlers[sig_num].func = obj;
|
||||
return old_handler;
|
||||
if (old_handler != NULL)
|
||||
return old_handler;
|
||||
else
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(signal_doc,
|
||||
|
@ -367,8 +370,13 @@ signal_getsignal(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
old_handler = Handlers[sig_num].func;
|
||||
Py_INCREF(old_handler);
|
||||
return old_handler;
|
||||
if (old_handler != NULL) {
|
||||
Py_INCREF(old_handler);
|
||||
return old_handler;
|
||||
}
|
||||
else {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(getsignal_doc,
|
||||
|
|
Loading…
Reference in New Issue