[Pyrex] compiler dislikes 'pointer to object'

David McNab david at rebirthing.co.nz
Tue Jun 22 23:55:08 CEST 2004


Hi,

As part of an optimisation, I'm replacing a python list with a C array 
of pointers to object.

However, the pyrex compiler barfs at declarations like:

   cdef object *objlist

What I'm having to do as a workaround is include:

   cdef extern from "Python.h":
       ... my other decs from python.h...
       ctypedef void *PyObject

This works, but to assign objects to this C array, I'm having to cast them:

   objlist[i] = <PyObject *>some_object

and to retrieve them, I have to cast them back:

   cur_obj = <object>objlist[i]

Would it be possible at some stage for Pyrex to support 'pointer to 
object' and other similar C types?

-- 
Cheers
David




More information about the Pyrex mailing list