Skip to content

Self doesn't support an async iterator protocol #118

Closed as not planned
Closed as not planned

Description

@erwinkinn

Hello.
I've got a problem with Self type when using it as it's done in types-aiofiles
I've made a merge request, trying to fix it in there, but to be honest it looks like this problem relates to the async iterator protocol's support for the tying_extensions.Self type.
Whether it's possible to make such a thing?

Activity

  1. JelleZijlstra commented on Feb 20, 2023

    @JelleZijlstra
    Member

    This seems like a mypy bug to me. typing-extensions doesn't really affect how type checkers interpret Self: the runtime Self object does very little. Please report your issue to mypy instead (ideally with a full, standalone sample that reproduces the bug).

  2. Gobot1234 commented on Feb 20, 2023

    @Gobot1234
    Contributor

    Hi, I think you've stumbled across a mypy bug, there is nothing in PEP 673 that stipulates that Self cannot be used inside of the async iterator protocol furthermore, running your code in your issue pyright there are no complaints.
    image
    Source for aiofiles stubs:
    image

  3. hauntsaninja commented on Feb 20, 2023

    @hauntsaninja
    Collaborator

    Make sure you're using mypy 1.0 or newer

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions