[Numpy-discussion] pyrex c_numpy.pyx problem

Stefan van der Walt stefan at sun.ac.za
Wed Jan 31 08:55:43 EST 2007


Hi,

Pyrex 0.9.5.1 doesn't like the following snippet out of c_numpyx.pyx:

    ctypedef extern class numpy.broadcast [object PyArrayMultiIterObject]:
        cdef int numiter
        cdef npy_intp size, index
        cdef int nd
        cdef npy_intp dimensions[NPY_MAXDIMS]
        cdef flatiter iters[NPY_MAXDIMS]

which corresponds to

typedef struct {
        PyObject_HEAD
        int                  numiter;                 /* number of iters */
        npy_intp             size;                    /* broadcasted size */
        npy_intp             index;                   /* current index */
        int                  nd;                      /* number of dims */
        npy_intp             dimensions[NPY_MAXDIMS]; /* dimensions */
        PyArrayIterObject    *iters[NPY_MAXARGS];     /* iterators */
} PyArrayMultiIterObject;

in ndarrayobject.h.

I changed it to be

    ctypedef extern class numpy.broadcast [object PyArrayMultiIterObject]:
        cdef int numiter
        cdef npy_intp size, index
        cdef int nd
        cdef npy_intp *dimensions
        cdef flatiter **iters

after which it complains

/tmp/pyrex/c_numpy.pxd:99:22: Pointer base type cannot be a Python object

so I changed the last line to

  cdef flatiter iters

That compiles, but it can't be right.

Any advice/suggestions?

Cheers
Stéfan



More information about the NumPy-Discussion mailing list