diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-10-02 22:48:14 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-10-02 22:48:14 +0000 |
commit | 5c876be793ddfee6da8bb4c0a1bd5b64bf1d5a97 (patch) | |
tree | abca2a1bf00f0acd592384281094da76e1c8973b /numpy | |
parent | d0791f7ade3b1d6d2673c0de93d58e0a3e225b4e (diff) | |
download | numpy-5c876be793ddfee6da8bb4c0a1bd5b64bf1d5a97.tar.gz |
Fix bugs: uncaught error, way record data-types print, asbuffer function fixed.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/numeric.py | 5 | ||||
-rw-r--r-- | numpy/core/src/arrayobject.c | 16 | ||||
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 63cb264b1..66a6e3a04 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -425,7 +425,10 @@ def array_repr(arr, max_line_width=None, precision=None, suppress_small=None): 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) diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 6f83eb5ee..03772199a 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -7519,7 +7519,7 @@ _broadcast_cast(PyArrayObject *out, PyArrayObject *in, } _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 @@ PyArray_FromAny(PyObject *op, PyArray_Descr *newtype, int min_depth, 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; diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 6fd3b6f70..95ec0a5a4 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -6531,7 +6531,7 @@ as_buffer(PyObject *dummy, PyObject *args, PyObject *kwds) 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); |