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

Guido van Rossum guido@python.org
Mon, 10 Feb 2003 08:07:56 -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.)

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.

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