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

diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 9daeafc..dc18211 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -107,20 +107,20 @@
     if (r->step == Py_None) {
         *step = 1;
     } else {
-        if (!PyInt_Check(r->step) && !PyLong_Check(r->step)) return -1;
+        if (!_PyAnyInt_Check(r->step)) return -1;
         *step = PyInt_AsSsize_t(r->step);
     }
     if (r->start == Py_None) {
         *start = *step < 0 ? length-1 : 0;
     } else {
-        if (!PyInt_Check(r->start) && !PyLong_Check(r->start)) return -1;
+        if (!_PyAnyInt_Check(r->start)) return -1;
         *start = PyInt_AsSsize_t(r->start);
         if (*start < 0) *start += length;
     }
     if (r->stop == Py_None) {
         *stop = *step < 0 ? -1 : length;
     } else {
-        if (!PyInt_Check(r->stop) && !PyLong_Check(r->stop)) return -1;
+        if (!_PyAnyInt_Check(r->stop)) return -1;
         *stop = PyInt_AsSsize_t(r->stop);
         if (*stop < 0) *stop += length;
     }