summaryrefslogtreecommitdiffstats
path: root/Modules/_struct.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-07-31 06:09:36 (GMT)
committerGitHub <noreply@github.com>2018-07-31 06:09:36 (GMT)
commit48c8bf21f97aeb124dbd48bf2bdec1ab4ebc5202 (patch)
tree6678ae7f56e368ef192b8e0f5988f7c317dbb246 /Modules/_struct.c
parentdc9039da239ee572eaaf56e4a026be1fc4d74e24 (diff)
downloadcpython-48c8bf21f97aeb124dbd48bf2bdec1ab4ebc5202.zip
cpython-48c8bf21f97aeb124dbd48bf2bdec1ab4ebc5202.tar.gz
cpython-48c8bf21f97aeb124dbd48bf2bdec1ab4ebc5202.tar.bz2
[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479)
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r--Modules/_struct.c6
1 files changed, 3 insertions, 3 deletions
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 @@ get_pylong(PyObject *v)
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 @@ get_pylong(PyObject *v)
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 @@ get_pylong(PyObject *v)
/* 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);