[Python-3000] Heaptypes (original) (raw)
"Martin v. Löwis" martin at v.loewis.de
Thu Jul 19 02:15:30 CEST 2007
- Previous message: [Python-3000] Heaptypes
- Next message: [Python-3000] Heaptypes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You broke backwards compatibility this way; I think that a pickle produced by Python 2.x should be readable by Python 3.0.
It is, is it not?
(I haven't decided whether to keep str8 or something like it, or whether to try to get rid of it completely).
I assumed the latter - and if it indeed goes away, it's certainly a bug to ever return str8 from pickle, right?
One possibility might be to first try to decode the STRING argument as utf-8, and if that fails to convert it to str8 instead. What do you think? I don't understand all of the changes you made in r56438, perhaps you can save most of them.
The question really is what bytes should be pickled as; that needs to be decided before fixing the code. Should it be built-in (and if so, using what code)? If not, it probably needs to go through reduce, and if so, what should reduce return for bytes object?
reduce currently does (O(s#)) with (ob_type, ob_bytes, ob_size). Now, s# creates a Unicode object, and the pickling fails to round-trip correctly.
If reduce returns a Unicode object, what encoding should be assumed? (which then needs to be symmetric with bytes())
If reduce returns a str8 object, you will have to keep str8 (or else you cannot pickle bytes).
Regards, Martin
- Previous message: [Python-3000] Heaptypes
- Next message: [Python-3000] Heaptypes
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]