diff options
Diffstat (limited to 'scipy/base/src/arrayobject.c')
-rw-r--r-- | scipy/base/src/arrayobject.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scipy/base/src/arrayobject.c b/scipy/base/src/arrayobject.c index 2ee6197a1..b54a4b8aa 100644 --- a/scipy/base/src/arrayobject.c +++ b/scipy/base/src/arrayobject.c @@ -3686,7 +3686,11 @@ array_itemsize_get(PyArrayObject *self) static PyObject * array_size_get(PyArrayObject *self) { - return PyLong_FromLongLong((longlong) PyArray_SIZE(self)); + longlong size=PyArray_SIZE(self); + if (size > MAX_INT || size < MIN_INT) + return PyLong_FromLongLong((longlong) size); + else + return PyInt_FromLong((long) size); } |