On 11/3/07, Georg Brandl <[EMAIL PROTECTED]> wrote:
> Alexandre Vassalotti schrieb:
> > On 11/1/07, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> >> When 3.0 encounters a 'str' object in a pickle written by 2.x, it has
> >> two choices: trying to convert it to a 3.0 (unicode) str object by
> >> applying some encoding, or interpreting it as a 3.0 bytes object.
> >
> > Currently, pickle decodes old string objects using latin-1. To me,
> > these seems to be a reasonable default (IMHO,
> > sys.getfilesystemencoding() would be slightly better). However, having
> > a default encoding might hide decoding errors. So, it may be a better
> > idea to simply return bytes by default and leave it to the application
> > to specify the encoding in the unpickling call.
>
> +1 for that. If no encoding is given, return bytes; if encoding (and
> possibly an errors argument) is given, return Unicode.

Right, this is exactly what I was originally suggesting. I still like
it better than any of the more elaborate proposals. As someone said,
you can do anything by subclassing Unpickler.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to