[issue20841] asyncio.StreamReader.readline() lack lines limit optional parameter

Guido van Rossum report at bugs.python.org
Mon Mar 3 19:21:30 CET 2014


Guido van Rossum added the comment:

>
> It seems to me that the StreamReader() limit parameter is for buffer size
> while the io.BytesIO.readline() "n" parameter is for maximum number of
> lines to be retreived, I guess.
>

You sound confused. The parameter for io.BytesIO.readline() limits the
number of bytes read in that call. The StreamReader limit parameter also
limits the number of bytes read, in all readline() calls. However, the
effect is different -- if you exceed the limit in io.BytesIO.readline() you
get an unterminated line; if you exceed the limit in
StreamReader.readline(), the call raises an exception.

> And since the StreamReader().readline() does not accept parameter, it
> still cannot be used in other modules (like http.client.parse_headers()).

Since StreamReader.readline() must be used with yield from, you can't use
it in http.client.parse_headers() anyway.

----------

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


More information about the Python-bugs-list mailing list