Skip to content

Protocols can't inherit from AsyncIterator #126699

Closed

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

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Nov 11, 2024
  2. added a commit that references this issue on Nov 12, 2024
  3. added 2 commits that reference this issue on Nov 12, 2024
  4. added 2 commits that reference this issue on Dec 2, 2024
  5. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Dec 8, 2024
  6. added a commit that references this issue on Dec 8, 2024
  7. added a commit that references this issue on Jan 12, 2025
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