can't run cython on mtrand.pyx

Grabbed numpy-1.7.0 source. Cython is 0.18
cython mtrand.pyx produces lots of errors.

On Wed, Mar 13, 2013 at 6:40 PM, Neal Becker ndbecker2@gmail.com wrote:
Grabbed numpy-1.7.0 source. Cython is 0.18
cython mtrand.pyx produces lots of errors.
It helps to copy-and-paste the errors that you are seeing.
In any case, Cython 0.18 works okay on master's mtrand.pyx sources.

Robert Kern wrote:
On Wed, Mar 13, 2013 at 6:40 PM, Neal Becker ndbecker2@gmail.com wrote:
Grabbed numpy-1.7.0 source. Cython is 0.18
cython mtrand.pyx produces lots of errors.
It helps to copy-and-paste the errors that you are seeing.
In any case, Cython 0.18 works okay on master's mtrand.pyx sources.
Well, this is the first error:
cython mtrand.pyx
Error compiling Cython file: ------------------------------------------------------------ ... PyArray_DIMS(oa) , NPY_DOUBLE) length = PyArray_SIZE(array) array_data = <double *>PyArray_DATA(array) itera = <flatiter>PyArray_IterNew(<object>oa) for i from 0 <= i < length: array_data[i] = func(state, (<double *>(itera.dataptr))[0]) ^ ------------------------------------------------------------
mtrand.pyx:177:41: Python objects cannot be cast to pointers of primitive types

On Wed, Mar 13, 2013 at 7:20 PM, Neal Becker ndbecker2@gmail.com wrote:
Robert Kern wrote:
On Wed, Mar 13, 2013 at 6:40 PM, Neal Becker ndbecker2@gmail.com wrote:
Grabbed numpy-1.7.0 source. Cython is 0.18
cython mtrand.pyx produces lots of errors.
It helps to copy-and-paste the errors that you are seeing.
In any case, Cython 0.18 works okay on master's mtrand.pyx sources.
Well, this is the first error:
cython mtrand.pyx
Error compiling Cython file:
... PyArray_DIMS(oa) , NPY_DOUBLE) length = PyArray_SIZE(array) array_data = <double *>PyArray_DATA(array) itera = <flatiter>PyArray_IterNew(<object>oa) for i from 0 <= i < length: array_data[i] = func(state, (<double *>(itera.dataptr))[0]) ^
mtrand.pyx:177:41: Python objects cannot be cast to pointers of primitive types
It looks like Cython 0.18 removed the members of flatiter in its copy of numpy.pxd in favor of the macros that are recommended for numpy 1.7. The irony is not lost on me.
This should be (<double *>PyArray_ITER_DATA(itera)[0]).
I'm not sure why it appears to work in master, since this code in mtrand.pyx did not change.
https://github.com/numpy/numpy/issues/3144
-- Robert Kern
participants (2)
-
Neal Becker
-
Robert Kern