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

numpy-svn at scipy.org numpy-svn at scipy.org
Thu Apr 24 23:01:34 EDT 2008


Author: charris
Date: 2008-04-24 22:01:33 -0500 (Thu, 24 Apr 2008)
New Revision: 5080

Modified:
   trunk/numpy/core/src/arrayobject.c
Log:
Fix ticket #736.
Try to cast strings numeric types when numbers needed.


Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2008-04-25 02:23:31 UTC (rev 5079)
+++ trunk/numpy/core/src/arrayobject.c	2008-04-25 03:01:33 UTC (rev 5080)
@@ -7479,11 +7479,8 @@
 
     check_it = (typecode->type != PyArray_CHARLTR);
 
-    stop_at_string = ((type == PyArray_OBJECT) ||
-                      (type == PyArray_STRING &&
-                       typecode->type == PyArray_STRINGLTR) ||
-                      (type == PyArray_UNICODE) ||
-                      (type == PyArray_VOID));
+    stop_at_string = (type != PyArray_STRING) ||
+                     (typecode->type == PyArray_STRINGLTR);
 
     stop_at_tuple = (type == PyArray_VOID && (typecode->names       \
                                               || typecode->subarray));
@@ -8613,7 +8610,7 @@
         else if (newtype->type_num == PyArray_OBJECT) {
             isobject = 1;
         }
-        if (PySequence_Check(op)) {
+        if (!PyString_Check(op) && PySequence_Check(op)) {
             PyObject *thiserr = NULL;
 
             /* necessary but not sufficient */




More information about the Numpy-svn mailing list