[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479)
diff --git a/Modules/_sre.c b/Modules/_sre.c
index efef8f5..081a1aa 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -3327,7 +3327,7 @@
{
Py_ssize_t i;
- if (PyInt_Check(index) || PyLong_Check(index))
+ if (_PyAnyInt_Check(index))
return PyInt_AsSsize_t(index);
i = -1;
@@ -3335,7 +3335,7 @@
if (self->pattern->groupindex) {
index = PyObject_GetItem(self->pattern->groupindex, index);
if (index) {
- if (PyInt_Check(index) || PyLong_Check(index))
+ if (_PyAnyInt_Check(index))
i = PyInt_AsSsize_t(index);
Py_DECREF(index);
} else