8000 3.13.0a6 breaks asyncio.Stream.readuntil with bytearray separator · Issue #117722 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

3.13.0a6 breaks asyncio.Stream.readuntil with bytearray separator #117722

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

Closed
bmerry opened this issue Apr 10, 2024 · 0 comments · Fixed by #117723
Closed

3.13.0a6 breaks asyncio.Stream.readuntil with bytearray separator #117722

bmerry opened this issue Apr 10, 2024 · 0 comments · Fixed by #117723
Labels
type-bug An unexpected behavior, bug, or error

Comments

@bmerry
Copy link
Contributor
bmerry commented Apr 10, 2024

Bug report

Bug description:

As discussed in #81322, the change I made in #16429 breaks asyncio.Stream.readuntil when used with iterable buffer-object types other than bytes (such as bytearray) because they're incorrectly interpreted as an iterable of separators.

I've got a patch ready; I'm just filing this bug to be able to reference it.

CPython versions tested on:

3.13, CPython main branch

Operating systems tested on:

Linux

Linked PRs

@bmerry bmerry added the type-bug An unexpected behavior, bug, or error label Apr 10, 2024
bmerry added a commit to bmerry/cpython that referenced this issue Apr 10, 2024
PR python#16429 introduced support for an iterable of separators in
Stream.readuntil. Since bytes-like types are themselves iterable, this
can introduce ambiguities in deciding whether the argument is an
iterator of separators or a singleton separator. In python#16429, only 'bytes'
was considered a singleton, but this will break code that passes other
buffer object types.

Fix it by only supporting tuples rather than arbitrary iterables.

Closes python#117722.
gvanrossum pushed a commit that referenced this issue Apr 11, 2024
gh-16429 introduced support for an iterable of separators in
Stream.readuntil. Since bytes-like types are themselves iterable, this
can introduce ambiguities in deciding whether the argument is an
iterator of separators or a singleton separator. In gh-16429, only 'bytes'
was considered a singleton, but this will break code that passes other
buffer object types.

Fix it by only supporting tuples rather than arbitrary iterables.

Closes gh-117722.
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
…ython#117723)

pythongh-16429 introduced support for an iterable of separators in
Stream.readuntil. Since bytes-like types are themselves iterable, this
can introduce ambiguities in deciding whether the argument is an
iterator of separators or a singleton separator. In pythongh-16429, only 'bytes'
was considered a singleton, but this will break code that passes other
buffer object types.

Fix it by only supporting tuples rather than arbitrary iterables.

Closes pythongh-117722.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant
0