-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update asyncio.Stream.readuntil #11755
Conversation
bmerry
commented
Apr 14, 2024
- Make use of ReadableBuffer to generalise the arguments accepted (implementing the suggestion made in a comment).
- Support a tuple of separators in Python 3.13, as implemented in gh-81322: support multiple separators in Stream.readuntil cpython#16429 and gh-117722: Fix Stream.readuntil with non-bytes buffer objects cpython#117723.
- Make use of ReadableBuffer to generalise the arguments accepted (implementing the suggestion made in a comment). - Support a tuple of separators in Python 3.13, as implemented in python/cpython#16429 and python/cpython#117723.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, and congratulations on getting that PR merged after only short five years. :) On issue below.
stdlib/asyncio/streams.pyi
Outdated
# Can be any buffer that supports len(); consider changing to a Protocol if PEP 688 is accepted | ||
async def readuntil(self, separator: bytes | bytearray | memoryview = b"\n") -> bytes: ... | ||
if sys.version_info >= (3, 13): | ||
async def readuntil(self, separator: _ReaduntilBuffer | tuple[_ReaduntilBuffer] = b"\n") -> bytes: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async def readuntil(self, separator: _ReaduntilBuffer | tuple[_ReaduntilBuffer] = b"\n") -> bytes: ... | |
async def readuntil(self, separator: _ReaduntilBuffer | tuple[_ReaduntilBuffer, ...] = b"\n") -> bytes: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'm always making that mistake with tuples. Fixed now.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |