[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479)
diff --git a/Modules/_struct.c b/Modules/_struct.c
index d83d57f..8b97672 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -110,7 +110,7 @@
PyObject *r, *w;
int converted = 0;
assert(v != NULL);
- if (!PyInt_Check(v) && !PyLong_Check(v)) {
+ if (!_PyAnyInt_Check(v)) {
PyNumberMethods *m;
/* Not an integer; first try to use __index__ to
convert to an integer. If the __index__ method
@@ -150,7 +150,7 @@
v = m->nb_int(v);
if (v == NULL)
return NULL;
- if (!PyInt_Check(v) && !PyLong_Check(v)) {
+ if (!_PyAnyInt_Check(v)) {
PyErr_SetString(PyExc_TypeError,
"__int__ method returned "
"non-integer");
@@ -169,7 +169,7 @@
/* Ensure we own a reference to v. */
Py_INCREF(v);
- assert(PyInt_Check(v) || PyLong_Check(v));
+ assert(_PyAnyInt_Check(v));
if (PyInt_Check(v)) {
r = PyLong_FromLong(PyInt_AS_LONG(v));
Py_DECREF(v);