Skip to content

Protocols can't inherit from AsyncIterator #126699

Closed
@tungol

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions