diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-06 10:14:10 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-06 10:14:10 +0000 |
commit | 6315c4c27eaeca7f2080ea585b1901e2b683b3ff (patch) | |
tree | 2777bf768a4fb125ad3ceb1940f46f70ad4e2d51 /numpy/core/src/arrayobject.c | |
parent | 5f5c4b92573a060d20cf9bbf70db00d45cda7268 (diff) | |
download | numpy-6315c4c27eaeca7f2080ea585b1901e2b683b3ff.tar.gz |
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.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r-- | numpy/core/src/arrayobject.c | 7 |
1 files changed, 5 insertions, 2 deletions
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("<err>"); + if (!lst) { + sub = PyString_FromString("<err>"); + PyErr_Clear(); + } else sub = PyObject_Str(lst); Py_XDECREF(lst); if (self->type_num != PyArray_VOID) { |