Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
to check for and handle errors correctly.
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index c729414..1493f8d 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -1087,8 +1087,8 @@
 
         has_key = PyDict_Contains(xoptions, key);
         Py_DECREF(key);
-        if (!has_key)
-            return 0;
+        if (has_key <= 0)
+            return has_key;
     }
 
     module = PyImport_ImportModule("faulthandler");