bpo-23325: Fix SIG_IGN and SIG_DFL int comparison in signal module by tiran · Pull Request #31759 · python/cpython (original) (raw)

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().