[Numpy-svn] r4851 - trunk/numpy/core/src

numpy-svn at scipy.org numpy-svn at scipy.org
Wed Mar 5 02:00:22 EST 2008


Author: charris
Date: 2008-03-05 01:00:18 -0600 (Wed, 05 Mar 2008)
New Revision: 4851

Modified:
   trunk/numpy/core/src/arraytypes.inc.src
Log:
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.



Modified: trunk/numpy/core/src/arraytypes.inc.src
===================================================================
--- trunk/numpy/core/src/arraytypes.inc.src	2008-03-05 06:20:04 UTC (rev 4850)
+++ trunk/numpy/core/src/arraytypes.inc.src	2008-03-05 07:00:18 UTC (rev 4851)
@@ -53,11 +53,7 @@
         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;




More information about the Numpy-svn mailing list