[Python-Dev] For review: PEP 307 - Extensions to the pickle protocol

Michael Hudson mwh@python.net
Mon, 10 Feb 2003 13:54:01 +0000


Guido van Rossum <guido@python.org> writes:

>> > I'm assuming a fair number of people have been following this already
>> > in the checkins list; I think it's ready for review on python-dev:
>> >
>> >   http://www.python.org/peps/pep-0307.html
>> 
>> Am I understanding correctly that this means the bozo __getstate__
>> method for classes with __slots__ can go away?
>
> Alas, not, for backwards compatibility reasons.  Pickle protocols 0
> and 1 can't be changed, and their pickles must be acceptable for
> Python 2.2, whose unpickling code doesn't know how to deal with slots.
> (Ditto for the semi-bozo __reduce__ inherited from object.)

OK, but I'm guessing classes with __slots__ will pickle without
intervention under protocol 2?  Just curious, no big worries.

> I could try to remove the bozo __getstate__ and move the check into
> the pickling code; that would certainly remove a wart from the code
> there.

Anything to get code out of typeobject.c <wink>.

Cheers,
M.

-- 
  I sense much distrust in you.  Distrust leads to cynicism, cynicism
  leads to bitterness, bitterness leads to the Awareness Of True
  Reality which is referred to by those-who-lack-enlightenment as
  "paranoia".  I approve.    -- David P. Murphy, alt.sysadmin.recovery