[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479)
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 4ac5cf5..2e7a1af 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -617,7 +617,7 @@
static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
{
int i;
- if (!PyInt_Check(obj) && !PyLong_Check(obj)) {
+ if (!_PyAnyInt_Check(obj)) {
PyObject *s = PyObject_Repr(obj);
if (s == NULL) return 1;
PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s",
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 9ce3b27..f19115d 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1780,7 +1780,7 @@
{
PyObject *v;
PyNumberMethods *nb;
- if (PyInt_Check(arg) || PyLong_Check(arg)) {
+ if (_PyAnyInt_Check(arg)) {
Py_INCREF(arg);
return arg;
}
@@ -1795,7 +1795,7 @@
v = nb->nb_int(arg);
if (v == NULL)
return NULL;
- if (PyInt_Check(v) || PyLong_Check(v))
+ if (_PyAnyInt_Check(v))
return v;
Py_DECREF(v);
PyErr_SetString(PyExc_TypeError,
diff --git a/Python/ceval.c b/Python/ceval.c
index b55b4d6..2088a27 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4750,8 +4750,7 @@
#undef ISINDEX
-#define ISINDEX(x) ((x) == NULL || \
- PyInt_Check(x) || PyLong_Check(x) || PyIndex_Check(x))
+#define ISINDEX(x) ((x) == NULL || _PyAnyInt_Check(x) || PyIndex_Check(x))
static PyObject *
apply_slice(PyObject *u, PyObject *v, PyObject *w) /* return u[v:w] */
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index c33b6c0..5707c9f 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1136,7 +1136,7 @@
/* If we failed to dig out the 'code' attribute,
just let the else clause below print the error. */
}
- if (PyInt_Check(value) || PyLong_Check(value))
+ if (_PyAnyInt_Check(value))
exitcode = (int)PyInt_AsLong(value);
else {
PyObject *sys_stderr = PySys_GetObject("stderr");