How can I store a reference to a Python object in a C struct? If I try
to define a C struct as follows:

ctypedef struct my_struct:
   object my_object

Cython tells me "C struct/union member cannot be a Python object". So,
I thought I'd try storing the objects as void *

ctypedef struct my_struct:
   void *my_object

But this is obviously problematic because when I make an assignment:

my_struct.my_object = <void *>some_object

The proper ref counting won't occur. Is there a way that I can
manually ref count this object? Is there another approach for storing
Python objects in a struct?

Any help would be appreciated.

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

Reply via email to