Robert Kern wrote: > Dag Sverre Seljebotn wrote: > >> Comment: The only "shady" part here is "contarr.data", which accesses >> implementation details of NumPy arrays. I'm guessing that this will >> never change, but I once planned to make a generic cython function >> "cython.buffer.bufptr" which would return the same pointer but it could >> be acquired through the buffer API. > > The canonical way to avoid accessing .data directly is to use the > PyArray_DATA() > macro (returns a void*). Similarly, dimensions and strides can be accessed > via > PyArray_DIMS() and PyArray_STRIDES().
Good point. (And I already do this for the buffer access in numpy.pxd, so the buffer access stuff is forwards-compatible with any change here.) The reason I want cython.buffer.bufptr BTW is to have a common way of accessing similar pointers for all buffer exporters, not only NumPy arrays. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
