[Pyrex] Structures containing pointers to Python objects

Greg Ewing greg at cosc.canterbury.ac.nz
Mon Feb 2 02:04:19 CET 2004


Konrad Hinsen <hinsen at cnrs-orleans.fr>:

>      ctypedef class Numeric.ArrayType [object PyArrayObject]:
> 
> How do I then write a declaration for a struct that contains a pointer 
> to a NumPy array?

You can't. You've declared Numeric.ArrayType as a Python type, and
Pyrex won't let you put references to Python objects in a struct
(because it wouldn't be able to manage the reference counting
properly).

If you can tell me more about why you need to do this, I may
be able to suggest a workaround.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list