summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/common.c21
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;
}