8000 Fix comparison in PyErr_SetInterruptEx() · python/cpython@3438104 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3438104

Browse files
committed
Fix comparison in PyErr_SetInterruptEx()
1 parent fdd38cb commit 3438104

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Modules/signalmodule.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,15 @@ PyErr_SetInterruptEx(int signum)
19111911

19121912
signal_state_t *state = &signal_global_state;
19131913
PyObject *func = get_handler(signum);
1914-
if (func != state->ignore_handler && func != state->default_handler) {
1914+
int is_ign = PyObject_RichCompareBool(func, state->ignore_handler, Py_EQ);
1915+
if (is_ign == -1) {
1916+
return -1;
1917+
}
1918+
int is_dfl = PyObject_RichCompareBool(func, state->default_handler, Py_EQ);
1919+
if (is_dfl == -1) {
1920+
return -1;
1921+
}
1922+
if ((is_ign == 0) && (is_dfl == 0)) {
19151923
trip_signal(signum);
19161924
}
19171925
return 0;

0 commit comments

Comments
 (0)
0