Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4558 > unrolled thread

Re: Pickling extension types

Started byRobert Kern <robert.kern@gmail.com>
First post2011-05-03 12:10 -0500
Last post2011-05-03 12:10 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Pickling extension types Robert Kern <robert.kern@gmail.com> - 2011-05-03 12:10 -0500

#4558 — Re: Pickling extension types

FromRobert Kern <robert.kern@gmail.com>
Date2011-05-03 12:10 -0500
SubjectRe: Pickling extension types
Message-ID<mailman.1116.1304442645.9059.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web