summaryrefslogtreecommitdiff
path: root/numpy/random
diff options
context:
space:
mode:
authorKevin Sheppard <kevin.k.sheppard@gmail.com>2017-08-22 10:43:06 +0100
committerKevin Sheppard <kevin.k.sheppard@gmail.com>2017-08-22 10:43:06 +0100
commit18756ad0dd29ebe896ba408efd1a43d7dd24960e (patch)
treed85e9ec466dd63f22030df1c70cff2e8266bfea4 /numpy/random
parent3c887aa5242857ef92870d2988de7c899c6415be (diff)
downloadnumpy-18756ad0dd29ebe896ba408efd1a43d7dd24960e.tar.gz
REF: Remove direct access to flatiter types
Replace direct access wiht Macro closes #3144
Diffstat (limited to 'numpy/random')
-rw-r--r--numpy/random/mtrand/mtrand.pyx4
-rw-r--r--numpy/random/mtrand/numpy.pxd1
2 files changed, 3 insertions, 2 deletions
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 = <flatiter>PyArray_IterNew(<object>oa)
with lock, nogil:
for i from 0 <= i < length:
- array_data[i] = func(state, (<double *>(itera.dataptr))[0])
+ array_data[i] = func(state, (<double *>PyArray_ITER_DATA(itera))[0])
PyArray_ITER_NEXT(itera)
else:
array = <ndarray>np.empty(size, np.float64)
@@ -536,7 +536,7 @@ cdef object discd_array(rk_state *state, rk_discd func, object size, ndarray oa,
itera = <flatiter>PyArray_IterNew(<object>oa)
with lock, nogil:
for i from 0 <= i < length:
- array_data[i] = func(state, (<double *>(itera.dataptr))[0])
+ array_data[i] = func(state, (<double *>PyArray_ITER_DATA(itera))[0])
PyArray_ITER_NEXT(itera)
else:
array = <ndarray>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)