Skip to content
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

Protocols can't inherit from AsyncIterator #126699

Closed
tungol opened this issue Nov 11, 2024 · 0 comments
Closed

Protocols can't inherit from AsyncIterator #126699

tungol opened this issue Nov 11, 2024 · 0 comments
Labels
stdlib Python modules in the Lib dir topic-typing type-bug An unexpected behavior, bug, or error

Comments

@tungol
Copy link
Contributor

tungol commented Nov 11, 2024

Bug report

Bug description:

AsyncIterator was removed from _PROTO_ALLOWLIST by #15647, without any discussion. It looks like an accident to me.

from typing import AsyncIterator, Protocol
class MyProto(AsyncIterator, Protocol): ...

result:

TypeError: Protocols can only inherit from other protocols, got <class 'collections.abc.AsyncIterator'>

CPython versions tested on:

3.12

Operating systems tested on:

macOS

Linked PRs

@tungol tungol added the type-bug An unexpected behavior, bug, or error label Nov 11, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 12, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 12, 2024
Yhg1s pushed a commit that referenced this issue Dec 2, 2024
…ols (GH-126702) (#126762)

gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702)
(cherry picked from commit feb3e0b)

Co-authored-by: Stephen Morton <[email protected]>
Yhg1s pushed a commit that referenced this issue Dec 2, 2024
…ols (GH-126702) (#126761)

gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702)
(cherry picked from commit feb3e0b)

Co-authored-by: Stephen Morton <[email protected]>
@tungol tungol closed this as completed Dec 8, 2024
@picnixz picnixz added the stdlib Python modules in the Lib dir label Dec 8, 2024
picnixz pushed a commit to picnixz/cpython that referenced this issue Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-typing type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants