diff options
author | Travis E. Oliphant <teoliphant@gmail.com> | 2012-07-17 21:55:08 -0500 |
---|---|---|
committer | Travis E. Oliphant <teoliphant@gmail.com> | 2012-07-17 21:55:08 -0500 |
commit | 88cf94d5ddc1c42e2ff078dc4fbb3c626efedae3 (patch) | |
tree | ec2686d33a5d6bca2241fdb1d71e3a2f3e060e31 | |
parent | 7b8d30b4c1dc0f33d9988d47de24c77cbeea41f8 (diff) | |
download | numpy-88cf94d5ddc1c42e2ff078dc4fbb3c626efedae3.tar.gz |
Fix-up logic so that it is more readable.
-rw-r--r-- | numpy/core/src/multiarray/common.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/numpy/core/src/multiarray/common.c b/numpy/core/src/multiarray/common.c index 123ec62e7..5ab8f92bc 100644 --- a/numpy/core/src/multiarray/common.c +++ b/numpy/core/src/multiarray/common.c @@ -33,21 +33,24 @@ _array_find_python_scalar_type(PyObject *op) } } else if (PyLong_Check(op)) { - /* if integer can fit into a longlong then return that*/ + /* check to see if integer can fit into a longlong or ulonglong + and return that --- otherwise return object */ if ((PyLong_AsLongLong(op) == -1) && PyErr_Occurred()) { PyErr_Clear(); - if ((PyLong_AsUnsignedLongLong(op) == (unsigned long long) -1) - && PyErr_Occurred()){ - PyErr_Clear(); - } - else { - return PyArray_DescrFromType(NPY_ULONGLONG); - } - return PyArray_DescrFromType(NPY_OBJECT); } else { return PyArray_DescrFromType(NPY_LONGLONG); } + + if ((PyLong_AsUnsignedLongLong(op) == (unsigned long long) -1) + && PyErr_Occurred()){ + PyErr_Clear(); + } + else { + return PyArray_DescrFromType(NPY_ULONGLONG); + } + + return PyArray_DescrFromType(NPY_OBJECT); } return NULL; } |