[Python-Dev] when is binary mode required for pickle?

Tim Peters tim_one@email.msn.com
Wed, 12 Feb 2003 22:57:07 -0500


[Neal Norwitz]
> Is the new pickling definitely going in to 2.3?

Yes.  In fact, at this point, completing changes to cPickle.c is a gating
factor for 2.3a2.

> If so, has anyone started working on fixing the documentation?

Only in the sense that an enormous amount of time (both Guido's and mine)
went into the PEP.

> The most important changes I know of are the bin/protocol parameters.

For most people, yes.  "bin" is deprecated, "proto" should not be named
(cPickle doesn't accept keyword arguments), and passing -1 is the best thing
to do if you don't care about reading a pickle under an older version of
Python than the one that wrote the pickle.  For compatibility reasons,
though, the default proto value had to remain 0.

There's also a ton of valuable info in the PEP about how extension types get
pickled, and how to influence that.  Alas, while that may be complete and
accurate now, I'm not sure how comprehensible it is.

The existing __reduce__ docs are out of date, in that (a) __reduce__ can
return (up to) a 5-tuple now; and, (b) it's not just types written in C that
can exploit __reduce__ (new-style classes in Python can too, and this was
also true in 2.2).