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

Guido van Rossum guido@python.org
Mon, 10 Feb 2003 09:38:08 -0500


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

Yes.

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

I'll give that a try right now.

--Guido van Rossum (home page: http://www.python.org/~guido/)