bpo-38787: Add PyCFunction_CheckExact() macro for exact type checks (GH-20024)
… now that we allow subtypes of PyCFunction.
Also add PyCMethod_CheckExact() and PyCMethod_Check() for checks against the PyCMethod subtype.
diff --git a/Objects/abstract.c b/Objects/abstract.c
index b014f79..5b85b01 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -900,7 +900,7 @@
Py_DECREF(result);
if (op_slot == NB_SLOT(nb_rshift) &&
- PyCFunction_Check(v) &&
+ PyCFunction_CheckExact(v) &&
strcmp(((PyCFunctionObject *)v)->m_ml->ml_name, "print") == 0)
{
PyErr_Format(PyExc_TypeError,