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

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Oct 13 15:13:22 CDT 2006


Author: oliphant
Date: 2006-10-13 15:13:17 -0500 (Fri, 13 Oct 2006)
New Revision: 3332

Modified:
   trunk/numpy/core/src/arrayobject.c
Log:
Fix ticket #342.

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-10-13 19:56:17 UTC (rev 3331)
+++ trunk/numpy/core/src/arrayobject.c	2006-10-13 20:13:17 UTC (rev 3332)
@@ -6706,18 +6706,6 @@
         if (PyString_Check(s) || PyBuffer_Check(s) || PyUnicode_Check(s))
                 return stop_at_string ? 0:1;
         if (stop_at_tuple && PyTuple_Check(s)) return 0;
-        if ((e=PyObject_GetAttrString(s, "__array_interface__")) != NULL) {
-                d = -1;
-                if (PyDict_Check(e)) {
-                        PyObject *new;
-                        new = PyDict_GetItemString(e, "shape");
-                        if (new && PyTuple_Check(new))
-                                d = PyTuple_GET_SIZE(new);
-                }
-                Py_DECREF(e);
-                if (d>-1) return d;
-        }
-        else PyErr_Clear();
         if ((e=PyObject_GetAttrString(s, "__array_struct__")) != NULL) {
                 d = -1;
                 if (PyCObject_Check(e)) {
@@ -6731,6 +6719,18 @@
                 if (d > -1) return d;
         }
         else PyErr_Clear();
+        if ((e=PyObject_GetAttrString(s, "__array_interface__")) != NULL) {
+                d = -1;
+                if (PyDict_Check(e)) {
+                        PyObject *new;
+                        new = PyDict_GetItemString(e, "shape");
+                        if (new && PyTuple_Check(new))
+                                d = PyTuple_GET_SIZE(new);
+                }
+                Py_DECREF(e);
+                if (d>-1) return d;
+        }
+        else PyErr_Clear();
 
         if (PySequence_Length(s) == 0)
                 return 1;
@@ -7211,11 +7211,8 @@
         int type = typecode->type_num;
         int itemsize = typecode->elsize;
 
-        check_it = ((type != PyArray_STRING) &&
-                    (type != PyArray_UNICODE) &&
-                    (type != PyArray_VOID) &&
-                    (type != PyArray_CHAR));
-                    
+        check_it = (typecode->type != PyArray_CHARLTR);
+
         stop_at_string = ((type == PyArray_OBJECT) ||   
                           (type == PyArray_STRING && 
                            typecode->type == PyArray_STRINGLTR) ||     



More information about the Numpy-svn mailing list