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


Groups > comp.lang.python > #4642

Re: Pickling extension types

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'args': 0.07; 'omit': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'slot': 0.09; 'tuple': 0.09; 'underlying': 0.09; 'am,': 0.14; 'described': 0.14; 'wrote:': 0.14; '10:45': 0.16; '2-tuple': 0.16; '__init__': 0.16; 'enigma': 0.16; 'kern': 0.16; 'received:216.62': 0.16; 'received:216.62.213': 0.16; 'received:enthought.com': 0.16; 'slot.': 0.16; 'argument': 0.16; 'allocated': 0.19; 'interpret': 0.19; 'saying': 0.22; 'code': 0.22; 'header:In-Reply-To:1': 0.22; 'insert': 0.22; 'posted': 0.22; 'optional': 0.23; 'says': 0.25; 'object': 0.27; 'work.': 0.27; 'elements': 0.29; 'stefan': 0.29; 'argue': 0.31; 'to:addr:python-list': 0.32; 'header:X-Complaints- To:1': 0.34; 'got': 0.34; 'requires': 0.35; 'returned': 0.35; 'header:User-Agent:1': 0.35; 'long.': 0.35; 'rather': 0.36; 'error.': 0.36; 'think': 0.36; 'should': 0.37; 'but': 0.38; 'received:org': 0.38; 'anything': 0.38; 'though': 0.38; 'back.': 0.39; 'docs': 0.39; 'returning': 0.39; 'to:addr:python.org': 0.39; 'header:Mime-Version:1': 0.39; 'attempt': 0.40; 'would': 0.40; 'header:Received:5': 0.40; 'positions': 0.62; 'our': 0.63; 'world': 0.65; 'believe': 0.66; 'eco': 0.84; 'subject:types': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robert Kern <robert.kern@gmail.com>
Subject Re: Pickling extension types
Date Wed, 04 May 2011 13:30:36 -0500
Organization The Church of Last Thursday
References <BANLkTi=sUu_VFKrW+KSk8-RDzr5vgSLKqQ@mail.gmail.com> <ippu74$199$1@dough.gmane.org> <BANLkTin_8569Lk-s9y-6Vhb=47628hxsVQ@mail.gmail.com> <iprq2b$pp5$1@dough.gmane.org> <BANLkTimSgQs0YChMfN4HGBnFT8N+P4dJng@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host outbound.enthought.com
User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
In-Reply-To <BANLkTimSgQs0YChMfN4HGBnFT8N+P4dJng@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1164.1304533849.9059.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 82.94.164.166
X-Trace 1304533849 news.xs4all.nl 81479 [::ffff:82.94.164.166]:54553
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4642

Show key headers only | View raw


On 5/4/11 10:45 AM, Stefan Kuzminski wrote:
> 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..

Let's take a step back. The documentation says to return a tuple between 2 and 5 
elements long. You can omit the optional ones or use Nones in their place. The 
original code you posted allocated a 5-tuple, but did not insert anything into 
positions 2, 3, or 4. This was an error. You should have returned a 2-tuple of 
the type object in the 0-index slot and the argument tuple in the 1-index slot. 
Are you saying that you just returned the argument tuple? I don't think that 
would work.

-- 
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


Thread

Re: Pickling extension types Robert Kern <robert.kern@gmail.com> - 2011-05-04 13:30 -0500

csiph-web