[issue1724366] cPickle module doesn't work with universal line endings

Alexander Belopolsky report at bugs.python.org
Thu Jul 15 17:41:32 CEST 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

> The pickle.py docsstrings in 2.7+ contain the following text
> (amongst others): 
>
>       .. Protocol 0 is the
>       only protocol that can be written to a file opened in text
>       mode and read back successfully.

Hmm, indeed.  The ReST documentation also has the following note:

"""
Note: Be sure to always open pickle files created with protocols >= 1 in binary mode. For the old ASCII-based pickle protocol 0 you can use either text mode or binary mode as long as you stay consistent.
"""

but as Gabriel mentioned above, this should be qualified by at least adding unless pickle contains unicode strings with embedded '\r' on platforms that use '\r' as a part of its end of line sequence.

I don't think changing the way unicode is pickled is an option.  Fixing this aspect of cPickle to behave more like pickle.py given the number of other differences does not look like a good use of developer's time.

I think this is the case were existing behavior should just be better documented.  See also issue616013.

----------
assignee: belopolsky -> 
components: +Documentation
dependencies: +cPickle documentation incomplete
resolution: invalid -> 
versions: +Python 2.7 -Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1724366>
_______________________________________


More information about the Python-bugs-list mailing list