Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Use macro access to flatiter objects in mtrand.pyx #3144

Open
rkern opened this Issue · 2 comments

2 participants

@rkern
Owner

Cython 0.18's numpy.pxd removes direct member access to flatiter and other objects in favor of the macros. mtrand.pyx still uses direct member access. E.g.

https://github.com/numpy/numpy/blob/a530098e816e1164efdb356ac2280ba25bfb1c7f/numpy/random/mtrand/mtrand.pyx#L178

@charris
Owner

The errors can be reproduced by replacing include "numpy.pxd" by from numpy cimport * at the top of the mtrand.pyx file and renaming the local numpy.pxd so cython can't find it. Looks like there will still be an error because the cython pxd file is missing NPY_ARRAY_ALIGNED.

@charris
Owner

Likewise, it looks like we can't fix these types of errors:

        multi = <broadcast> PyArray_MultiIterNew(3, <void *>oa, <void *>ob, <void *>oc)
        array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE)
                                                          ^
------------------------------------------------------------

mtrand.pyx:276:59: Cannot convert Python object to 'npy_intp *'

There don't appear to be any getters for multi.nd and multi.dimensions. So it won't be possible to make mtrand.pyx compile with the current Cython numpy.pxd file. We should probably add some macros and coordinate with the Cython folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.