Pickling extension types

Stefan Kuzminski stefan.kuzminski at gmail.com
Wed May 4 11:45:50 EDT 2011


I got this to work by returning from reduce just the args that the __init__
of the type being pickled requires ( rather than the 5 length tuple
described in the pickling docs ), I am not going to argue with it though..

thank you *very* much for the help!
S


On Wed, May 4, 2011 at 11:06 AM, Robert Kern <robert.kern at gmail.com> wrote:

> On 5/3/11 9:28 PM, Stefan Kuzminski wrote:
>
>> closer I think
>>
>> 1) I changed tp_name to be 'observation.MV' ( module is named
>> observation.c )
>> and now I get a new error..
>>
>> PicklingError: Can't pickle <type 'observation.MV'>: import of module
>> observation failed
>>
>> 2) here is the init function, sorry I did not include it in the original
>> listing
>>
>> void initobservation(void) {
>>
>>   PyObject *m;
>>   m = Py_InitModule("observation", observation_methods);
>>
>>   Py_INCREF(&PyMV_Type);
>>   PyModule_AddObject(m, "MV", (PyObject *)&PyMV_Type);
>>
>> }
>>
>
> Without seeing the whole C code, or the Python code you are trying, I can't
> help much more.
>
>
> --
> 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
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110504/8256a78a/attachment-0001.html>


More information about the Python-list mailing list