You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncio.Protocol.data_received prototype not respected: when using create_connection to create a tcp transport data_received is being called with a bytearray object instead of bytes.
If this is expected behaviour libraries like httpx and such should be warned or the prototype modified, although I doubt it's intended because it would suppose the generator doesn't hold reference to it otherwise data could change while stored in buffered stuff.
Correct output: @@@@@@@@@@ b'HTTP/1.0 ...WHATEVER THE SERVER ANSWERS...'
Faulty output: @@@@@@@@@@ bytearray(b'HTTP/1.0 ...WHATEVER THE SERVER ANSWERS...')
Your environment
On Windows 11 x64
Tested on:
3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)]
Working as expected in:
3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)]
Related problems
Link to the thread where I found a conflicting thing (it's being solved there as a workaround) encode/httpx#2305 (comment)
Bug report
asyncio.Protocol.data_receivedprototype not respected: when usingcreate_connectionto create a tcp transportdata_receivedis being called with abytearrayobject instead ofbytes.If this is expected behaviour libraries like httpx and such should be warned or the prototype modified, although I doubt it's intended because it would suppose the generator doesn't hold reference to it otherwise data could change while stored in buffered stuff.
Correct output:
@@@@@@@@@@ b'HTTP/1.0 ...WHATEVER THE SERVER ANSWERS...'Faulty output:
@@@@@@@@@@ bytearray(b'HTTP/1.0 ...WHATEVER THE SERVER ANSWERS...')Your environment
On Windows 11 x64
Tested on:
Working as expected in:
Related problems
Link to the thread where I found a conflicting thing (it's being solved there as a workaround)
encode/httpx#2305 (comment)
EDIT: simplified the minimal example
Linked PRs