Closed jonathanslenders closed 2 months ago
It looks like it was fixed in cpython v3.12.0a4 thanks to this commit: https://github.com/python/cpython/commit/1bb68ba6d9de6bb7f00aee11d135123163f15887
However, it would still be good to handle the issue here for Python 3.10 and 3.11. (3.9 doesn't have the issue).
Review welcome. As I mentioned in the CPython issue, I was able to locally reproduce this even on the latest 3.12 release.
Things to check first
[X] I have searched the existing issues and didn't find my bug already reported there
[X] I have checked that my bug is still present in the latest release
AnyIO version
4.4.0
Python version
3.11
What happened?
StreamProtocol
, here: https://github.com/agronholm/anyio/blob/master/src/anyio/_backends/_asyncio.py#L1075 incorrectly assumes that it will only getbytes
objects as an argument. Unfortunately, on Windows, that's not the case. For theProactorEventLoop
, we'll getbytearray
objects here.See:
I think the quickest fix for anyio is to accept
bytearray
as well, and convert it intobytes
, regardless of what typeshed/cpython do.How can we reproduce the bug?
(Sorry, I don't have access to a Windows machine right now to create an example, but please let me know if an example script is needed.)