Storing a C pointer in a Python class instance

Carl Banks pavlovevidence at
Wed Sep 30 17:18:38 CEST 2009

On Sep 30, 5:24 am, "lallous" <lall... at> wrote:
> Hello
> After using the PyCObject, I cannot pickle the class anymore.
> Any simple solution to this problem? (or resorting to __reduce__ is the only
> solution?)

You can't pickle a CObject, you'd have to create a custom type (one
that implements one of the pickling methods) for that.  Or arrange for
whatever object contains the CObject to pack and unpack it manually.

Out of curiosity, what kind of data you storing in this CObject?
Maybe we can help you choose a better way to handle it at the C level.

Carl Banks

More information about the Python-list mailing list