Pickling extension types
Robert Kern
robert.kern at gmail.com
Tue May 3 13:10:23 EDT 2011
On 5/3/11 11:48 AM, Stefan Kuzminski wrote:
> Hi all,
>
> I have an extension type written in C, but I cannot get it to pickle, any
> insights would be greatly appreciated.
>
> I see in the docs that I should define a __reduce__ method and that does get
> called, but I don't know specifically the type of the 'callable object' that
> should be the first thing in the tuple returned by __reduce__.
It should be a callable PyObject* that takes the arguments given in the rest of
the tuple. Often, this is just the type itself. So probably
(PyObject*)PyMV_Type, if you give the right arguments in the rest of the tuple.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list