uvloop
uvloop copied to clipboard
Can't peek at paused bytes (socket behind TCPTransport unavailable)
- uvloop version: 0.14.0
- Python version: 3.8.2
- Platform: linux
-
Can you reproduce the bug with
PYTHONASYNCIODEBUGin env?: n/a (this is an api thing) -
Does uvloop behave differently from vanilla asyncio? How?:
-
vanilla asyncio: the underlying socket is available in
transport._sockfor consenting coders aware of the risks using "private" members - uvloop: the underlying socket is not available to python at all (or at least I can't find it via introspection)
-
vanilla asyncio: the underlying socket is available in
FWIW, one reason I'm running into this right now is that I have a case where the transport is paused for reading (transport.pause_reading()), but I would still like to peek at the bytes with sock.recv(n, socket.MSG_PEEK).
vanilla asyncio: the underlying socket is available in transport._sock for consenting coders aware of the risks using "private" members
This won't be the case soon, as asyncio adopts the same proxy-socket object design choice that uvloop made.
Ideally we need to add new API to asyncio for peeking.