Message32118
The culprit is cPickle.c; it takes certain shortcuts for read() and readline() depending on which type of file you pass in.
For a true file object, it uses its own implementation for those two methods, ignoring the file mode.
But it appears that there is NO WAY universal line endings could work if the pickle contains any unicode object. The pickle format for Unicode quotes any \n but *not* \r so the unpickler cannot determine, when it sees a "\r", if it is a MAC end-of-line or an embedded "\r".
So, the only safe end-of-line character for a pickle using protocol 0 is "\n", and that means that the file must be written in binary mode.
(This may also indicate that you cannot read unicode objects with embedded \r in a MAC using protocol 0, but I don't have a MAC to test it).
So, until this is fixed (either the module or the documentation), one should forget about universal line endings and write all pickle files as binary. (This way ALL lines end in \n and it should work fine on all platforms)
|
|
Date |
User |
Action |
Args |
2007-08-23 14:54:06 | admin | link | issue1724366 messages |
2007-08-23 14:54:06 | admin | create | |
|