asyncio.BaseProactorEventLoop
feeds bytearray objects to the Protocol.data_received
callback, contradicting docs
#123496
Labels
Bug report
Bug description:
The documentation says: https://docs.python.org/3/library/asyncio-protocol.html#asyncio.Protocol.data_received :
So, it says it should be a bytes object. However:
self._data
is abytearray
here:cpython/Lib/asyncio/proactor_events.py
Line 191 in f8a736b
cpython/Lib/asyncio/proactor_events.py
Line 230 in f8a736b
Protocol.data_received
here:cpython/Lib/asyncio/proactor_events.py
Line 274 in f8a736b
So, there we get a bytearray object.
This conflicts with the current type hints from typeshed: https://github.com/python/typeshed/blob/main/stdlib/asyncio/protocols.pyi#L14 as well as with the docs.
Is this intentional or not?
The patch is simple:
Related typeshed issue: python/typeshed#12606
CPython versions tested on:
3.13
Operating systems tested on:
Windows
The text was updated successfully, but these errors were encountered: