Protocols can't inherit from AsyncIterator · Issue #126699 · python/cpython · GitHub
Skip to content

Protocols can't inherit from AsyncIterator #126699

Description

@tungol

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions