diff options
author | Travis Oliphant <oliphant@enthought.com> | 2005-09-26 22:46:59 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2005-09-26 22:46:59 +0000 |
commit | 491a3fd7c49420ab040889a5a11a228a90c0a073 (patch) | |
tree | 592c3aadc3fdc4e6bafc099272cc4b00a60063b5 /scipy/base/src/arrayobject.c | |
parent | d02e0f884aeeeff62c2ff1eb304dcb7563d688eb (diff) | |
download | numpy-491a3fd7c49420ab040889a5a11a228a90c0a073.tar.gz |
Return Long integer on size only if necessary.
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); } |