diff options
author | Travis Oliphant <oliphant@enthought.com> | 2008-08-10 20:05:49 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2008-08-10 20:05:49 +0000 |
commit | 75c15c8c697eba656e333612821d44cdd46134fe (patch) | |
tree | 5c060635957de96064cf5dcc59c11e05b99f9b8b /numpy/core/src | |
parent | fd932a4a0aa9e3c26f3fa968b06b9332dfc229b8 (diff) | |
download | numpy-75c15c8c697eba656e333612821d44cdd46134fe.tar.gz |
*Full recompile needed*: changed the name of hasobject structure member to flags in the PyArray_Descr structure and increased it's size to int
Diffstat (limited to 'numpy/core/src')
-rw-r--r-- | numpy/core/src/arrayobject.c | 13 | ||||
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 16 |
2 files changed, 15 insertions, 14 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 1fbbe6a9e..5b2390f03 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -11155,7 +11155,7 @@ 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}, - {"flags", T_UBYTE, offsetof(PyArray_Descr, hasobject), RO, NULL}, + {"flags", T_UBYTE, offsetof(PyArray_Descr, flags), RO, NULL}, {NULL}, }; @@ -11553,7 +11553,7 @@ arraydescr_reduce(PyArray_Descr *self, PyObject *args) PyTuple_SET_ITEM(state, 5, PyInt_FromLong(elsize)); PyTuple_SET_ITEM(state, 6, PyInt_FromLong(alignment)); - PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->hasobject)); + PyTuple_SET_ITEM(state, 7, PyInt_FromLong(self->flags)); PyTuple_SET_ITEM(ret, 2, state); return ret; @@ -11565,7 +11565,8 @@ arraydescr_reduce(PyArray_Descr *self, PyObject *args) static int _descr_find_object(PyArray_Descr *self) { - if (self->hasobject || self->type_num == PyArray_OBJECT || + if (PyDataType_FLAGCHK(self, NPY_ITEM_HASOBJECT) || + self->type_num == PyArray_OBJECT || self->kind == 'O') return NPY_OBJECT_DTYPE_FLAGS; if (PyDescr_HASFIELDS(self)) { @@ -11581,7 +11582,7 @@ _descr_find_object(PyArray_Descr *self) return 0; } if (_descr_find_object(new)) { - new->hasobject = NPY_OBJECT_DTYPE_FLAGS; + new->flags = NPY_OBJECT_DTYPE_FLAGS; return NPY_OBJECT_DTYPE_FLAGS; } } @@ -11712,9 +11713,9 @@ arraydescr_setstate(PyArray_Descr *self, PyObject *args) self->alignment = alignment; } - self->hasobject = dtypeflags; + self->flags = dtypeflags; if (version < 3) { - self->hasobject = _descr_find_object(self); + self->flags = _descr_find_object(self); } Py_INCREF(Py_None); return Py_None; diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 7a5a76123..b556b3c5c 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -4704,7 +4704,7 @@ _use_inherit(PyArray_Descr *type, PyObject *newobj, int *errflag) new->names = conv->names; Py_XINCREF(new->names); } - new->hasobject = conv->hasobject; + new->flags = conv->flags; Py_DECREF(conv); *errflag = 0; return new; @@ -4783,7 +4783,7 @@ _convert_from_tuple(PyObject *obj) PyDimMem_FREE(shape.ptr); newdescr->subarray = _pya_malloc(sizeof(PyArray_ArrayDescr)); newdescr->subarray->base = type; - newdescr->hasobject = type->hasobject; + newdescr->flags = type->flags; Py_INCREF(val); newdescr->subarray->shape = val; Py_XDECREF(newdescr->fields); @@ -4873,7 +4873,7 @@ _convert_from_array_descr(PyObject *obj, int align) "two fields with the same name"); goto fail; } - dtypeflags |= (conv->hasobject & NPY_FROM_FIELDS); + dtypeflags |= (conv->flags & NPY_FROM_FIELDS); tup = PyTuple_New((title == NULL ? 2 : 3)); PyTuple_SET_ITEM(tup, 0, (PyObject *)conv); if (align) { @@ -4902,7 +4902,7 @@ _convert_from_array_descr(PyObject *obj, int align) new->fields = fields; new->names = nameslist; new->elsize = totalsize; - new->hasobject=dtypeflags; + new->flags=dtypeflags; if (maxalign > 1) { totalsize = ((totalsize+maxalign-1)/maxalign)*maxalign; } @@ -4955,7 +4955,7 @@ _convert_from_list(PyObject *obj, int align) Py_DECREF(key); goto fail; } - dtypeflags |= (conv->hasobject & NPY_FROM_FIELDS); + dtypeflags |= (conv->flags & NPY_FROM_FIELDS); PyTuple_SET_ITEM(tup, 0, (PyObject *)conv); if (align) { int _align; @@ -4973,7 +4973,7 @@ _convert_from_list(PyObject *obj, int align) new = PyArray_DescrNewFromType(PyArray_VOID); new->fields = fields; new->names = nameslist; - new->hasobject=dtypeflags; + new->flags=dtypeflags; if (maxalign > 1) { totalsize = ((totalsize+maxalign-1)/maxalign)*maxalign; } @@ -5199,7 +5199,7 @@ _convert_from_dict(PyObject *obj, int align) } Py_DECREF(tup); if ((ret == PY_FAIL) || (newdescr->elsize == 0)) goto fail; - dtypeflags |= (newdescr->hasobject & NPY_FROM_FIELDS); + dtypeflags |= (newdescr->flags & NPY_FROM_FIELDS); totalsize += newdescr->elsize; } @@ -5217,7 +5217,7 @@ _convert_from_dict(PyObject *obj, int align) } new->names = names; new->fields = fields; - new->hasobject = dtypeflags; + new->flags = dtypeflags; return new; fail: |