bpo-42006: Stop using PyDict_GetItem, PyDict_GetItemString and _PyDict_GetItemId. (GH-22648)
These functions are considered not safe because they suppress all internal errors
and can return wrong result. PyDict_GetItemString and _PyDict_GetItemId can
also silence current exception in rare cases.
Remove no longer used _PyDict_GetItemId.
Add _PyDict_ContainsId and rename _PyDict_Contains into
_PyDict_Contains_KnownHash.
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 3440894..0ab3a71 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1427,10 +1427,9 @@ signal_exec(PyObject *m)
return -1;
#endif
- IntHandler = PyDict_GetItemString(d, "default_int_handler");
+ IntHandler = PyMapping_GetItemString(d, "default_int_handler");
if (!IntHandler)
return -1;
- Py_INCREF(IntHandler);
_Py_atomic_store_relaxed(&Handlers[0].tripped, 0);
for (int i = 1; i < NSIG; i++) {