[New-bugs-announce] [issue43524] Addition of peek and peekexactly methods to asyncio.StreamReader
Awal Garg
report at bugs.python.org
Tue Mar 16 19:51:15 EDT 2021
New submission from Awal Garg <awalgarg at gmail.com>:
I propose the addition of the following methods to asyncio.StreamReader:
> coroutine peek(n=-1)
> Same as read, but does not remove the returned data from the internal buffer.
>
> coroutine peekexactly(n)
> Same as readexactly, but does not remove the returned data from the internal buffer.
My use case is to multiplex a few protocols over a single TCP socket, for which I need to non-destructively read a few bytes from the socket to decide which parser to hand the stream over to.
Thoughts?
----------
components: asyncio
messages: 388895
nosy: asvetlov, awalgarg, yselivanov
priority: normal
severity: normal
status: open
title: Addition of peek and peekexactly methods to asyncio.StreamReader
type: enhancement
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43524>
_______________________________________
More information about the New-bugs-announce
mailing list