New submission from Alan Cristhian:

I use pickle to serialize data. The pickle.dumps() methods sometimes introduce 
the b"\n" character:

    >>> import pickle
    >>> tuple_with_10 = (10,)
    >>> result = pickle.dumps(tuple_with_10, protocol=4)
    >>> result
    b'\x80\x04\x95\x05\x00\x00\x00\x00\x00\x00\x00K\n\x85\x94.'
    >>> b"\n" in result
    True

The same is true with all protocols.

So, if I read the stream with StreamReader.readline() method and then try to 
deserialize with pickle.loads(), I got and EOLError because the stream has been 
cut.

An default argument in the readline() method can solve this issue.

----------
components: asyncio
messages: 252249
nosy: Alan.Cristhian, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: End mark argument for StreamReader.readline() method
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25310>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to