[Numpy-svn] r3244 - in trunk/numpy/core: . src

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Oct 2 18:48:20 EDT 2006


Author: oliphant
Date: 2006-10-02 17:48:14 -0500 (Mon, 02 Oct 2006)
New Revision: 3244

Modified:
   trunk/numpy/core/numeric.py
   trunk/numpy/core/src/arrayobject.c
   trunk/numpy/core/src/multiarraymodule.c
Log:
Fix bugs: uncaught error, way record data-types print, asbuffer function fixed.

Modified: trunk/numpy/core/numeric.py
===================================================================
--- trunk/numpy/core/numeric.py	2006-10-02 22:17:56 UTC (rev 3243)
+++ trunk/numpy/core/numeric.py	2006-10-02 22:48:14 UTC (rev 3244)
@@ -425,7 +425,10 @@
         typename=arr.dtype.name
         lf = ''
         if issubclass(arr.dtype.type, flexible):
-            typename = "'%s'" % str(arr.dtype)
+            if arr.dtype.names:
+                typename = "%s" % str(arr.dtype)
+            else:
+                typename = "'%s'" % str(arr.dtype)
             lf = '\n'+' '*len("array(")
         return cName + "(%s, %sdtype=%s)" % (lst, lf, typename)
 

Modified: trunk/numpy/core/src/arrayobject.c
===================================================================
--- trunk/numpy/core/src/arrayobject.c	2006-10-02 22:17:56 UTC (rev 3243)
+++ trunk/numpy/core/src/arrayobject.c	2006-10-02 22:48:14 UTC (rev 3244)
@@ -7519,7 +7519,7 @@
         }
         _pya_free(buffers[0]);
         _pya_free(buffers[1]);
-        if (!PyArray_ISNUMBER(in) && PyErr_Occurred()) return -1;
+        if (PyErr_Occurred()) return -1;
         return 0;
 }
 
@@ -8282,28 +8282,26 @@
                         isobject = 1;
                 }
                 if (PySequence_Check(op)) {
-                        PyObject *thiserr;
+                        PyObject *thiserr=NULL;
                         /* necessary but not sufficient */
                         Py_INCREF(newtype);
                         r = Array_FromSequence(op, newtype, flags & FORTRAN,
                                                min_depth, max_depth);
-                        if (r == NULL && (thiserr=PyErr_Occurred()) && \
-                            !PyErr_GivenExceptionMatches(thiserr, 
-                                                         PyExc_MemoryError)) {
+                        if (r == NULL && (thiserr=PyErr_Occurred())) {
+                                if (PyErr_GivenExceptionMatches(thiserr, 
+                                                                PyExc_MemoryError))
+                                        return NULL;
                                 /* If object was explicitly requested, 
                                    then try nested list object array creation
                                 */
+                                PyErr_Clear();
                                 if (isobject) {
-                                        PyErr_Clear();
                                         Py_INCREF(newtype);
                                         r = ObjectArray_FromNestedList  \
                                                 (op, newtype, flags & FORTRAN);
                                         seq = TRUE;
                                         Py_DECREF(newtype);
                                 }
-                                else {
-                                        PyErr_Clear();
-                                }
                         }
                         else {
                                 seq = TRUE;

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-10-02 22:17:56 UTC (rev 3243)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-10-02 22:48:14 UTC (rev 3244)
@@ -6531,7 +6531,7 @@
         void *memptr;
         static char *kwlist[] = {"mem", "size", "readonly", NULL};
         if (!PyArg_ParseTupleAndKeywords(args, kwds, "O" \
-                                         NPY_SSIZE_T_PYFMT "|O&", 
+                                         NPY_SSIZE_T_PYFMT "|O&", kwlist,
                                          &mem, &size, PyArray_BoolConverter,
                                          &ro)) return NULL;
         memptr = PyLong_AsVoidPtr(mem);




More information about the Numpy-svn mailing list