bpo-40170: Always define PyIter_Check() as a function (GH-24548)
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 74a73ee..c93309b 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -2732,12 +2732,12 @@ PyObject_GetIter(PyObject *o)
}
}
-#undef PyIter_Check
-
-int PyIter_Check(PyObject *obj)
+int
+PyIter_Check(PyObject *obj)
{
- return Py_TYPE(obj)->tp_iternext != NULL &&
- Py_TYPE(obj)->tp_iternext != &_PyObject_NextNotImplemented;
+ PyTypeObject *tp = Py_TYPE(obj);
+ return (tp->tp_iternext != NULL &&
+ tp->tp_iternext != &_PyObject_NextNotImplemented);
}
/* Return next item.