summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2008-03-05 07:00:18 +0000
committerCharles Harris <charlesr.harris@gmail.com>2008-03-05 07:00:18 +0000
commit2439416c25cdb8bee7caadea53f375cfe0d22b87 (patch)
tree9fd13e750c82028912e66df16dd2494e2e816cf4 /numpy/core/src
parenta783bfde54692d7c192c5e90c8d9def5af47d552 (diff)
downloadnumpy-2439416c25cdb8bee7caadea53f375cfe0d22b87.tar.gz
Simplify MyPyLong_AsUnsignedLongLong and make it compatible with old C
compilers. This function will still fail for numbers less than -2**63, which is not quite correct. The problem is with the conversion functions provided by Python. The alternative is to write our own or call the Python modulus function to convert to the valid C ranges. The other conversion functions have the same problem.
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/arraytypes.inc.src6
1 files changed, 1 insertions, 5 deletions
diff --git a/numpy/core/src/arraytypes.inc.src b/numpy/core/src/arraytypes.inc.src
index 210a2230e..1ab7569f8 100644
--- a/numpy/core/src/arraytypes.inc.src
+++ b/numpy/core/src/arraytypes.inc.src
@@ -53,11 +53,7 @@ MyPyLong_AsUnsignedLongLong(PyObject *vv)
ret = PyLong_AsUnsignedLongLong(vv);
if (PyErr_Occurred()) {
PyErr_Clear();
- longlong new = PyLong_AsLongLong(vv);
- if (!PyErr_Occurred() && new < 0)
- ret = (ulonglong) new;
- else
- ret = NPY_MAX_ULONGLONG;
+ ret = (ulonglong) PyLong_AsLongLong(vv);
}
Py_DECREF(vv);
return ret;