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

numpy-svn@scip... numpy-svn@scip...
Tue Apr 22 19:20:59 CDT 2008


Author: charris
Date: 2008-04-22 19:20:57 -0500 (Tue, 22 Apr 2008)
New Revision: 5065

Modified:
   trunk/numpy/core/src/arraytypes.inc.src
Log:
Make None be NaN for float types.


Modified: trunk/numpy/core/src/arraytypes.inc.src
===================================================================
--- trunk/numpy/core/src/arraytypes.inc.src	2008-04-22 19:09:02 UTC (rev 5064)
+++ trunk/numpy/core/src/arraytypes.inc.src	2008-04-23 00:20:57 UTC (rev 5065)
@@ -29,8 +29,12 @@
 MyPyFloat_AsDouble(PyObject *obj)
 {
     double ret = 0;
-    PyObject *num = PyNumber_Float(obj);
+    PyObject *num;
 
+    if (obj == Py_None) {
+        return _getNAN();
+    }
+    num = PyNumber_Float(obj);
     if (num == NULL) {
         return _getNAN();
     }



More information about the Numpy-svn mailing list