Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4558
| From | Robert Kern <robert.kern@gmail.com> |
|---|---|
| Subject | Re: Pickling extension types |
| Date | 2011-05-03 12:10 -0500 |
| Organization | The Church of Last Thursday |
| References | <BANLkTi=EQdNdiUWvN-63Vjp2QRBQgVLxvQ@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1116.1304442645.9059.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Pickling extension types Robert Kern <robert.kern@gmail.com> - 2011-05-03 12:10 -0500
csiph-web