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

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

Protocols can't inherit from AsyncIterator #126699

tungol opened this issue Nov 11, 2024 · 0 comments
Labels
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
…ls (pythonGH-126702)

(cherry picked from commit feb3e0b)

Co-authored-by: Stephen Morton <github@tungol.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 12, 2024
…ls (pythonGH-126702)

(cherry picked from commit feb3e0b)

Co-authored-by: Stephen Morton <github@tungol.org>
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 <github@tungol.org>
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 <github@tungol.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-typing type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants