[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479)

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 2baf920..7a1a694 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -6121,7 +6121,7 @@
         elem = PySequence_GetItem(groups, i);
         if (!elem)
             return NULL;
-        if (!PyInt_Check(elem) && !PyLong_Check(elem)) {
+        if (!_PyAnyInt_Check(elem)) {
             PyErr_SetString(PyExc_TypeError,
                             "groups must be integers");
             Py_DECREF(elem);