[issue20841] asyncio.StreamReader.readline() lack lines limit optional parameter
Guido van Rossum added the comment: Yes, your whole world will be turned upside-down. However, we have to do it one module at a time -- the approach will be different for each case. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20841 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20841] asyncio.StreamReader.readline() lack lines limit optional parameter
New submission from Alexandre JABORSKA: This prevent using StreamReader as a normal file object in some circumstances (like http header parsing) -- components: Library (Lib) messages: 212624 nosy: ajaborsk priority: normal severity: normal status: open title: asyncio.StreamReader.readline() lack lines limit optional parameter type: behavior versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20841 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20841] asyncio.StreamReader.readline() lack lines limit optional parameter
STINNER Victor added the comment: The readline() limit can be set in the StreamReader constructor: http://docs.python.org/dev/library/asyncio-stream.html#streamreader Oh, it looks like it is not documented :-( -- nosy: +gvanrossum, haypo, yselivanov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20841 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20841] asyncio.StreamReader.readline() lack lines limit optional parameter
Alexandre JABORSKA added the comment: Hum... 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. And since the StreamReader().readline() does not accept parameter, it still cannot be used in other modules (like http.client.parse_headers()). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20841 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20841] asyncio.StreamReader.readline() lack lines limit optional parameter
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 rep...@bugs.python.org http://bugs.python.org/issue20841 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20841] asyncio.StreamReader.readline() lack lines limit optional parameter
Alexandre JABORSKA added the comment: Well, You're right, I'm confused, and I cannot use the http.client.parse_headers(). I made a workaround by reading all lines in a BytesIO and parse this one. Anyway, if it not possible to use a file like object with the asyncio module, which is absolutly fantastic (I installed the 3.4RC just for it), a lot a modules will need a rewrite/adaptation to be useable. I guess every module that use any kind of IO is the list : logging, servers, parsers, etc. Thanks ! Alexandre -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20841 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com