[Python-Dev] pickle self-delimiting

Charles-François Natali cf.natali at gmail.com
Tue Apr 1 23:56:20 CEST 2014


> No reason AFAIK. However, the fact that it is self-delimited is implicit
> in the fact that "Bytes past the pickled object's representation are
> ignored": https://docs.python.org/dev/library/pickle.html#pickle.load

I find this sentence worrying: it could lead one to think that load() could
read more bytes than the expected object representation size: this would
make pickle actually non self-delimiting, and could lead to problems when
reading e.g. from a socket, since an extraneous read() could block.

I think it's worth making it clear in the doc, I'll open an issue on the
tracker.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140401/0d429978/attachment.html>


More information about the Python-Dev mailing list