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

numpy-svn@scip... numpy-svn@scip...
Wed Apr 9 13:05:03 CDT 2008


Author: charris
Date: 2008-04-09 13:04:59 -0500 (Wed, 09 Apr 2008)
New Revision: 5004

Modified:
   trunk/numpy/core/src/arraytypes.inc.src
Log:
Apply patch supplied by philbinj to fix ticket 630.


Modified: trunk/numpy/core/src/arraytypes.inc.src
===================================================================
--- trunk/numpy/core/src/arraytypes.inc.src	2008-04-09 15:31:28 UTC (rev 5003)
+++ trunk/numpy/core/src/arraytypes.inc.src	2008-04-09 18:04:59 UTC (rev 5004)
@@ -106,6 +106,19 @@
 static double
 MyPyFloat_AsDouble(PyObject *obj)
 {
+        PyObject *tmp;
+        double d;
+        if (PyString_Check(obj)) {
+                tmp = PyFloat_FromString(obj, 0);
+                if (tmp) {
+                        d = PyFloat_AsDouble(tmp);
+                        Py_DECREF(tmp);
+                        return d;
+                }
+                else {
+                        return _getNAN();
+                }
+        }
         if (obj == Py_None) return _getNAN();
         return PyFloat_AsDouble(obj);
 }



More information about the Numpy-svn mailing list