From 18756ad0dd29ebe896ba408efd1a43d7dd24960e Mon Sep 17 00:00:00 2001 From: Kevin Sheppard Date: Tue, 22 Aug 2017 10:43:06 +0100 Subject: REF: Remove direct access to flatiter types Replace direct access wiht Macro closes #3144 --- numpy/random/mtrand/mtrand.pyx | 4 ++-- numpy/random/mtrand/numpy.pxd | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'numpy') diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index c4b4f7748..f5b741df6 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -211,7 +211,7 @@ cdef object cont1_array(rk_state *state, rk_cont1 func, object size, itera = PyArray_IterNew(oa) with lock, nogil: for i from 0 <= i < length: - array_data[i] = func(state, ((itera.dataptr))[0]) + array_data[i] = func(state, (PyArray_ITER_DATA(itera))[0]) PyArray_ITER_NEXT(itera) else: array = np.empty(size, np.float64) @@ -536,7 +536,7 @@ cdef object discd_array(rk_state *state, rk_discd func, object size, ndarray oa, itera = PyArray_IterNew(oa) with lock, nogil: for i from 0 <= i < length: - array_data[i] = func(state, ((itera.dataptr))[0]) + array_data[i] = func(state, (PyArray_ITER_DATA(itera))[0]) PyArray_ITER_NEXT(itera) else: array = np.empty(size, int) diff --git a/numpy/random/mtrand/numpy.pxd b/numpy/random/mtrand/numpy.pxd index d5b0d74ca..32b19c1ab 100644 --- a/numpy/random/mtrand/numpy.pxd +++ b/numpy/random/mtrand/numpy.pxd @@ -130,6 +130,7 @@ cdef extern from "numpy/arrayobject.h": object PyArray_IterNew(object arr) void PyArray_ITER_NEXT(flatiter it) nogil + void* PyArray_ITER_DATA(flatiter it) nogil dtype PyArray_DescrFromType(int) -- cgit v1.2.1