diff options
-rw-r--r-- | numpy/core/include/numpy/ndarrayobject.h | 6 | ||||
-rw-r--r-- | numpy/core/src/multiarray/iterators.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h index 31e69fb6d..c3c5e7cb7 100644 --- a/numpy/core/include/numpy/ndarrayobject.h +++ b/numpy/core/include/numpy/ndarrayobject.h @@ -696,6 +696,8 @@ struct PyArrayIterObject_tag { PyArrayObject *ao; char *dataptr; /* pointer to current item*/ npy_bool contiguous; + + npy_intp bounds[NPY_MAXDIMS][2]; npy_iter_get_dataptr_t translate; } ; @@ -945,6 +947,8 @@ typedef struct { PyArrayObject *ao; char *dataptr; /* pointer to current item*/ npy_bool contiguous; + + npy_intp bounds[NPY_MAXDIMS][2]; npy_iter_get_dataptr_t translate; /* @@ -954,8 +958,6 @@ typedef struct { /* Dimensions is the dimension of the array */ npy_intp dimensions[NPY_MAXDIMS]; - /* Bounds of the neighborhood to iterate over */ - npy_intp bounds[NPY_MAXDIMS][2]; /* Neighborhood points coordinates are computed relatively to the point pointed * by _internal_iter */ diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c index 9d3921012..d0213d38e 100644 --- a/numpy/core/src/multiarray/iterators.c +++ b/numpy/core/src/multiarray/iterators.c @@ -297,7 +297,13 @@ array_iter_base_init(PyArrayIterObject *it, PyArrayObject *ao) if (i > 0) { it->factors[nd-i-1] = it->factors[nd-i] * ao->dimensions[nd-i]; } + it->bounds[i][0] = 0; + it->bounds[i][1] = ao->dimensions[i] - 1; } + + /* Not used for basic iterator: set to NULL to cause a segfault right away + * if misused */ + it->translate = NULL; PyArray_ITER_RESET(it); return (PyObject *)it; |