Mark Lodato wrote:
> How can I implement this as a pxd?  I used pxi for two reasons: (1)
> import_ufunc() needs to be called before anything is used, so by

I'm wondering whether this can be done automatically by giving the pxd 
the right name so that Cython imports the right module. If you declare 
external Python extension types in the pxd, at least, this happens. But 
may not work in this case.

> including the pxi I can force this to be done automatically, and (2)
> the ufunc API functions expect arrays that will stay in existence
> forever.  I used globals since this is the easiest route, but you
> can't define globals in a pxd.  I guess I can malloc and just create a
> memory leak, but this seems sloppy.

Yeah, sorry, I overlooked that part when glancing at it. I say just keep 
using a pxi; one can always change it later if we come up with something.

So, a) try to integrate the pxd in a nice way, since it exposes NumPy 
API (i.e. put it either inside the numpy.pxd file, or under it in the 
package hierarchy), and b) also supply a cython_ufunc_utils.pxi (or 
similar). If you put a pxi file in Cython/Includes it will always be in 
the include path as well.

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to