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

diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index aaefa2d..871eea3 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -796,7 +796,7 @@
          * NotImplemented.  Only comparisons with core numeric types raise
          * TypeError.
          */
-        if (PyInt_Check(w) || PyLong_Check(w) ||
+        if (_PyAnyInt_Check(w) ||
             PyFloat_Check(w) || PyComplex_Check(w)) {
             PyErr_SetString(PyExc_TypeError,
                             "no ordering relation is defined "
@@ -809,7 +809,7 @@
     assert(PyComplex_Check(v));
     TO_COMPLEX(v, i);
 
-    if (PyInt_Check(w) || PyLong_Check(w)) {
+    if (_PyAnyInt_Check(w)) {
         /* Check for 0.0 imaginary part first to avoid the rich
          * comparison when possible.
          */