bpo-23325: Fix SIG_IGN and SIG_DFL int comparison in signal module#31759
bpo-23325: Fix SIG_IGN and SIG_DFL int comparison in signal module#31759miss-islington merged 4 commits intopython:mainfrom
Conversation
1f535e0 to
3438104
Compare
Modules/signalmodule.c
Outdated
| signal_state_t *state = &signal_global_state; | ||
| PyObject *func = get_handler(signum); | ||
| if (func != state->ignore_handler && func != state->default_handler) { | ||
| int is_ign = PyObject_RichCompareBool(func, state->ignore_handler, Py_EQ); |
There was a problem hiding this comment.
Is it okay to call a Python code in PyErr_SetInterruptEx()?
If func is a custom callable, it can have an __eq__ method which can call an arbitrary Python code here.
It may be safer to use PyLong_Check() + PyLong_GetLongAndOverflow().
There was a problem hiding this comment.
Good point!
I took a different approach and added a helper function. We can safely assume that the internal handler objects are always exact longs. Comparison between exact longs should never fail.
67876c2 to
cc4df05
Compare
|
Thanks @tiran for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
|
Sorry, @tiran, I could not cleanly backport this to |
|
GH-31768 is a backport of this pull request to the 3.10 branch. |
…ythonGH-31759) (cherry picked from commit c8a47e7) Co-authored-by: Christian Heimes <[email protected]>
…H-31759) (cherry picked from commit c8a47e7) Co-authored-by: Christian Heimes <[email protected]>
https://bugs.python.org/issue23325
Automerge-Triggered-By: GH:tiran