From 6315c4c27eaeca7f2080ea585b1901e2b683b3ff Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Fri, 6 Jan 2006 10:14:10 +0000 Subject: Added new feature to .view method so that if the argument is a sub-type of the ndarray, an object is returned with all the information of the array. --- numpy/core/src/arrayobject.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'numpy/core/src/arrayobject.c') diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 11ebc4d04..494d77a13 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -3797,7 +3797,7 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) /* For now, let's just use this to create an empty, contiguous array of a specific type and shape. - */ + */ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&|O&O&LO&i", kwlist, PyArray_IntpConverter, @@ -8352,7 +8352,10 @@ arraydescr_str(PyArray_Descr *self) if (self->fields && self->fields != Py_None) { PyObject *lst; lst = arraydescr_protocol_descr_get(self); - if (!lst) sub = PyString_FromString(""); + if (!lst) { + sub = PyString_FromString(""); + PyErr_Clear(); + } else sub = PyObject_Str(lst); Py_XDECREF(lst); if (self->type_num != PyArray_VOID) { -- cgit v1.2.1