summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-01-25 23:01:35 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-01-25 23:01:35 +0000
commit2a71223ff0ca8ff7c9f7cb69c73de19ae19c1782 (patch)
treeadf492ee27927fd99f6ab02c8f176ce5984559b4 /numpy/core/src/arrayobject.c
parent9dc43c41723027dc9cb924e98d3e7a37f4f7069d (diff)
downloadnumpy-2a71223ff0ca8ff7c9f7cb69c73de19ae19c1782.tar.gz
Raise error when using same field names and disallow object fields for now.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index f82be52f1..33a86efe5 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -3761,7 +3761,14 @@ PyArray_NewFromDescr(PyTypeObject *subtype, PyArray_Descr *descr, int nd,
self->flags |= OWN_DATA;
/* It is bad to have unitialized OBJECT pointers */
- if (descr == &OBJECT_Descr) {
+ /* which could also be sub-fields of a VOID array */
+ if (descr == &OBJECT_Descr || descr->hasobject) {
+ if (descr->hasobject) {
+ PyErr_SetString(PyExc_TypeError,
+ "fields with object members "\
+ "not yet supported.");
+ goto fail;
+ }
memset(data, 0, sd);
}
}
@@ -8039,7 +8046,8 @@ static PyMemberDef arraydescr_members[] = {
{"byteorder", T_CHAR, offsetof(PyArray_Descr, byteorder), RO, NULL},
{"itemsize", T_INT, offsetof(PyArray_Descr, elsize), RO, NULL},
{"alignment", T_INT, offsetof(PyArray_Descr, alignment), RO, NULL},
- {NULL},
+ {"hasobject", T_UBYTE, offsetof(PyArray_Descr, hasobject), RO, NULL},
+ {NULL},
};
static PyObject *