Commit 12f3971c authored by Dag Sverre Seljebotn's avatar Dag Sverre Seljebotn

numpy.pxd: Old iteration method did not iterate dtype in order (fixes #371)

parent 3bf811ba
...@@ -124,7 +124,7 @@ cdef extern from "numpy/arrayobject.h": ...@@ -124,7 +124,7 @@ cdef extern from "numpy/arrayobject.h":
cdef int itemsize "elsize" cdef int itemsize "elsize"
cdef char byteorder cdef char byteorder
cdef object fields cdef object fields
cdef object names cdef tuple names
ctypedef extern class numpy.flatiter [object PyArrayIterObject]: ctypedef extern class numpy.flatiter [object PyArrayIterObject]:
# Use through macros # Use through macros
...@@ -696,10 +696,11 @@ cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset ...@@ -696,10 +696,11 @@ cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset
cdef tuple i cdef tuple i
cdef int endian_detector = 1 cdef int endian_detector = 1
cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
cdef tuple fields
for i in descr.fields.itervalues(): for childname in descr.names:
child = i[0] fields = descr.fields[childname]
new_offset = i[1] child, new_offset = fields
if (end - f) - (new_offset - offset[0]) < 15: if (end - f) - (new_offset - offset[0]) < 15:
raise RuntimeError("Format string allocated too short, see comment in numpy.pxd") raise RuntimeError("Format string allocated too short, see comment in numpy.pxd")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment