diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-11-17 19:39:02 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-11-17 19:39:02 +0000 |
commit | e2756cb71da612edbd7941fc896ef01ebc7424ed (patch) | |
tree | ad851ca0e05c4dffb0fc38ba8866856361f3af06 /numpy/core/src | |
parent | 9356329f5b5f6c658f0dd54363c25157c35a5841 (diff) | |
download | numpy-e2756cb71da612edbd7941fc896ef01ebc7424ed.tar.gz |
Understand array's of ctypes types.
Diffstat (limited to 'numpy/core/src')
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index ec57ee059..e35f9ccd4 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -50,8 +50,24 @@ _arraydescr_fromobj(PyObject *obj) if (dtypedescr) { ret = PyArray_DescrConverter(dtypedescr, &new); Py_DECREF(dtypedescr); - if (ret == PY_SUCCEED) return new; + if (ret == PY_SUCCEED) { + PyObject *length; + length = PyObject_GetAttrString(obj, "_length_"); + PyErr_Clear(); + if (length) { /* derived type */ + PyObject *newtup; + PyArray_Descr *derived; + newtup = Py_BuildValue("NO", new, length); + ret = PyArray_DescrConverter(newtup, &derived); + Py_DECREF(newtup); + if (ret == PY_SUCCEED) return derived; + PyErr_Clear(); + return NULL; + } + return new; + } PyErr_Clear(); + return NULL; } /* Understand ctypes structures -- bit-fields are not supported */ |