[Pyrex] declear opaque type

Greg Ewing greg at cosc.canterbury.ac.nz
Fri May 2 06:51:58 CEST 2003


"King C. Shu" <kingshu at myrealbox.com>:

> I just want to point out that Python C API has a PyCObject which can
> wrap an opaque C type.

I don't think I'd recommend using it, though. If an unknown
piece of Python code passes you a PyCObject, you have no way
of knowing whether it's wrapping a C object of the type
you're expecting. Better to define an extension type for
the purpose, then you get full type checking.

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