Pyrex pointer problem

Mike Rovner mike at
Wed Apr 23 20:53:52 CEST 2003

"Edward C. Jones" <edcjones at> wrote in message
news:b86aio$2b3$1 at
> I use Pyrex 0.7.2 and Python 2.2.2. For line "return" in
> "wrapped.pyx", I get the error message:
>      Cannot convert 'A_Struct' to Python object
> How do I fix this?

You are operating on single-linked list at C level.
Since Python has a notion of list you better consider returning C list as a
whole as Python list or tuple of iVals.
Another approach is to simulate Python list in C with __len__, __getitem__,
__setitem__ and other (mutable) sequence
methods (see

Which approach to choose depends on size of the list and intended usage.


More information about the Python-list mailing list