diff --git a/decode.c b/decode.c index df71658f6..58ba396a4 100644 --- a/decode.c +++ b/decode.c @@ -938,7 +938,7 @@ _imaging_tell_pyFd(PyObject *fd) Py_ssize_t location; result = PyObject_CallMethod(fd, "tell", NULL); - location = PyLong_AsSsize_t(result); + location = PyInt_AsSsize_t(result); Py_DECREF(result); return location; diff --git a/py3.h b/py3.h index 8adfac081..a2a1e264f 100644 --- a/py3.h +++ b/py3.h @@ -19,6 +19,7 @@ #define PyInt_FromLong PyLong_FromLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_FromSsize_t PyLong_FromSsize_t +#define PyInt_AsSsize_t PyLong_AsSsize_t #else /* PY_VERSION_HEX < 0x03000000 */ #define PY_ARG_BYTES_LENGTH "s#"