summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-09-18 20:36:43 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-09-18 20:36:43 +0000
commitadb82edb90a53825b785b11f1e95f2bcda98e456 (patch)
treef79c32617c0840e471fd119355073f75c078c24c
parent79b158bad6f2b7ed7bb7cd8786f03b73d1fb3c5a (diff)
downloadnumpy-adb82edb90a53825b785b11f1e95f2bcda98e456.tar.gz
Rework fix to #282
-rw-r--r--numpy/core/src/multiarraymodule.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c
index db360aa19..4f8c931ca 100644
--- a/numpy/core/src/multiarraymodule.c
+++ b/numpy/core/src/multiarraymodule.c
@@ -4529,7 +4529,7 @@ _convert_from_dict(PyObject *obj, int align)
totalsize = 0;
for(i=0; i<n; i++) {
PyObject *tup, *descr, *index, *item, *name, *off;
- int len, ret;
+ int len, ret, _align;
PyArray_Descr *newdescr;
/* Build item to insert (descr, offset, [title])*/
@@ -4552,6 +4552,10 @@ _convert_from_dict(PyObject *obj, int align)
goto fail;
}
PyTuple_SET_ITEM(tup, 0, (PyObject *)newdescr);
+ if (align) {
+ _align = newdescr->alignment;
+ maxalign = MAX(maxalign,_align);
+ }
if (offsets) {
long offset;
off = PyObject_GetItem(offsets, index);
@@ -4566,16 +4570,12 @@ _convert_from_dict(PyObject *obj, int align)
if (offset > totalsize) totalsize = offset;
}
else {
- if (align) {
- int _align = newdescr->alignment;
- if (_align > 1) totalsize = \
- ((totalsize + _align - 1)/_align)* \
- _align;
+ if (align && _align > 1) {
+ totalsize = ((totalsize + _align - 1) \
+ /_align)*_align;
}
PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(totalsize));
}
- if (align)
- maxalign = MAX(maxalign,newdescr->alignment);
if (len == 3) PyTuple_SET_ITEM(tup, 2, item);
name = PyObject_GetItem(names, index);
Py_DECREF(index);