Storing a C pointer in a Python class instance

Carl Banks pavlovevidence at gmail.com
Tue Sep 29 13:11:04 EDT 2009


On Sep 29, 9:42 am, sturlamolden <sturlamol... at yahoo.no> wrote:
> You can use PyCObject, or write your own extension type that wraps the
> pointer (very easy to to with Cython or Pyrex). The advantage of using
> an extension type is you have a guarantee from Python on the
> deallocator method being called (cdef __dealloc__ in Cython).

CObjects can be passed a C function as a deallocator; this should work
as reliably as a custom class deallocator.


Carl Banks



More information about the Python-list mailing list