Message411104
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)) { |
|
Date |
User |
Action |
Args |
2022-01-21 09:54:28 | christian.heimes | set | recipients:
+ christian.heimes, barry, vstinner, giampaolo.rodola, eli.bendersky, serhiy.storchaka, xiang.zhang |
2022-01-21 09:54:27 | christian.heimes | set | messageid: <1642758867.97.0.785553426968.issue23325@roundup.psfhosted.org> |
2022-01-21 09:54:27 | christian.heimes | link | issue23325 messages |
2022-01-21 09:54:27 | christian.heimes | create | |
|