Author Bruce Merry
Recipients Bruce Merry, yselivanov
Date 2017-11-16.19:09:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
While asyncio.StreamReader.readuntil is an improvement on only having readline, it is still quite limited e.g. you cannot have multiple possible terminators. The real problem is that it's not possible to roll your own without accessing _underscore fields (other than by reading one byte at a time, which I'm guessing would be bad for performance). I'm not sure exactly what a public API to assist would look like, but I think the following would be a good start:

1. A get_buffer method, that returns (self._buffer, self._eof); the caller must treat the buffer as readonly.
2. A wait_for_data method to wait for the return value of get_buffer to change (basically like current _wait_for_data)
3. Access to the _limit attribute.

With that available, I think readuntil or more complex variants of it could be implemented externally using only the public interface (consumption of data from the buffer would be via readexactly rather than by messing with the buffer array directly).
Date User Action Args
2017-11-16 19:09:48Bruce Merrysetrecipients: + Bruce Merry, yselivanov
2017-11-16 19:09:48Bruce Merrysetmessageid: <>
2017-11-16 19:09:48Bruce Merrylinkissue32052 messages
2017-11-16 19:09:48Bruce Merrycreate