diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-10-05 06:40:42 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-10-05 06:40:42 +0000 |
commit | 31016a0dee1512b12a56779f47bc03ac375d0736 (patch) | |
tree | df1a75a40455543d0a64bbb51fe30a055a82425e /numpy/core/src/arrayobject.c | |
parent | c76a2c4097fda804b05a713370ce077215e2ee7a (diff) | |
download | numpy-31016a0dee1512b12a56779f47bc03ac375d0736.tar.gz |
Fix issue #313. Also make sure shape attribute of dtype object always returns a tuple.
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 6e0c79d4c..8daeb39e8 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -10634,8 +10634,11 @@ arraydescr_shape_get(PyArray_Descr *self) if (self->subarray == NULL) { return PyTuple_New(0); } - Py_INCREF(self->subarray->shape); - return (PyObject *)(self->subarray->shape); + if (PyTuple_Check(self->subarray->shape)) { + Py_INCREF(self->subarray->shape); + return (PyObject *)(self->subarray->shape); + } + return Py_BuildValue("(O)", self->subarray->shape); } static PyObject * |