Protocols can't inherit from AsyncIterator #126699
Copy link
Copy link
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
gh-126699: allow AsyncIterator to be used as a base for Protocols (#1…
pythongh-126699: allow AsyncIterator to be used as a base for Protoco…
pythongh-126699: allow AsyncIterator to be used as a base for Protoco…
[3.13] gh-126699: allow AsyncIterator to be used as a base for Protoc…
[3.12] gh-126699: allow AsyncIterator to be used as a base for Protoc…
pythongh-126699: allow AsyncIterator to be used as a base for Protoco…
pythongh-126699: allow AsyncIterator to be used as a base for Protoco…