[Python-3000] pickle compatibility between 2.x and 3.0

Gregory P. Smith greg at krypto.org
Fri Nov 2 05:37:59 CET 2007


On 11/1/07, Facundo Batista <facundobatista at gmail.com> wrote:
>
> 2007/11/1, Guido van Rossum <guido at python.org>:
>
> > I could leave this all up to the 3.0 application, which would have to
> > "fix up" any bytes in the pickle it receives explicitly if it wants
> > to. Alternatively, I could add an encoding option to the pickle
> > loading APIs (and for full flexibility an errors option as well) so
> > that at least simple text-based applications might have a chance of
> > reading the data that they themselves wrote before they were ported to
> > 3.0 with minimal changes (only the unpickling calls would have to be
> > modified).
>
> I think that to make possible to the unpickling appl to specify which
> encoding to use is the best option here, so to avoid:
>
> - Need to change the appl that created the pickle (that can be not
> accesible).
>
> - Have to make the work by hand of dealing with that "fix up" everywhere.
>
> - Requests from developers to add a "magic guess" to discover
> automatically which encoding use.
>
> Regards,
>
> --
> .    Facundo


Brainstorming here... how about an optional callable argument when
unpickling to let the developers write their own "magic guess" function?
This callable should take a single parameter and its return value would be
used as the unpickled string.

Or is that too much work and not enough context in the callable to be
useful? People could just as easily write code to recurse through the
unpickled output converting the appropriate bytes objects as needed.

-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20071101/57478d08/attachment.htm 


More information about the Python-3000 mailing list