Christian Heimes <li...@cheimes.de> added the comment:
Understood, thanks! A trivial fix for the integer comparison bug would solve my issue: --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -527,21 +527,20 @@ signal_signal_impl(PyObject *module, int signalnum, PyObject *handler) "signal number out of range"); return NULL; } - if (handler == modstate->ignore_handler) { + if (PyCallable_Check(handler)) { + func = signal_handler; + } + else if (PyObject_RichCompareBool(handler, modstate->ignore_handler, Py_EQ) == 1) { func = SIG_IGN; } - else if (handler == modstate->default_handler) { + else if (PyObject_RichCompareBool(handler, modstate->default_handler, Py_EQ) == 1) { func = SIG_DFL; - } - else if (!PyCallable_Check(handler)) { + } else { _PyErr_SetString(tstate, PyExc_TypeError, "signal handler must be signal.SIG_IGN, " "signal.SIG_DFL, or a callable object"); return NULL; } - else { - func = signal_handler; - } /* Check for pending signals before changing signal handler */ if (_PyErr_CheckSignalsTstate(tstate)) { ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue23325> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com