This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年03月16日 21:16 by gvanrossum, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg63593 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年03月16日 21:16 | |
A pickled str instance written by 2.6 currently unpickles under 3.0 as a bytes instance. That would be correct if the intended use is binary data, but it's wrong if the intended use is text. My hunch is that there's more pickled text than binary data. (E.g. a dict containing instance variables uses (8-bit) str instances for the keys; these *must* be unpacked as (Unicode) str instances in 3.0.) The inverse issue also exists. We need to DECIDE this before starting to code (coding is probably minimal). I'm assigning the task to DECIDE (after discussion on the list) to myself. |
|||
| msg63678 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年03月17日 17:15 | |
We have a proposed solution for 2.x -> 3.x. In 3.x, an (8-bit) str instance received from 2.x will be decoded into a (Unicode) str instance. The encoding defaults to ASCII; you can specify a different encoding and also an error value on the load() or loads() call. This of course doesn't solve all problems; str instances representing binary data will be unpickled as strings. The app will have to deal with this. By default 3.x will *write* pickles using a new version number which is incompatible with 2.x. I'm not sure yet if we should allow writing pickles in 3.x that can be read in 2.x; we need use cases for that. |
|||
| msg63801 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2008年03月17日 22:58 | |
Checked in as r61467. When pickling a bytes instance in a protocol < 3, it is pickled as a user-defined type (essentially faking a __reduce__ operation) which can be read back correctly in 3.0 but probably not in 2.x. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:31 | admin | set | github: 46560 |
| 2008年03月17日 22:58:17 | gvanrossum | set | status: open -> closed resolution: accepted -> fixed messages: + msg63801 versions: - Python 2.6 |
| 2008年03月17日 20:29:45 | alexandre.vassalotti | set | nosy: + alexandre.vassalotti |
| 2008年03月17日 17:15:11 | gvanrossum | set | resolution: accepted messages: + msg63678 |
| 2008年03月17日 17:11:28 | gvanrossum | link | issue2324 superseder |
| 2008年03月16日 21:16:02 | gvanrossum | create | |