Skip to content

typing_extensions.pyi imports Protocol from typing.pyi rather than defining its own #7130

Description

@erictraut

Until recently, typing_extensions.pyi declared its own Protocol symbol as follows:

Protocol: _SpecialForm = ...

It now directly imports Protocol from typing.pyi and re-exports this symbol. This means pyright can no longer differentiate between the two symbols. There's an important difference because typing.Protocol will generate a runtime exception if used in versions of Python prior to 3.7, but typing_extensions.Protocol will not.

@JelleZijlstra, is there a reason this change was made? Or put another way, is there a reason not to change it back?

Here's a link to bug that describes the regression in pyright: microsoft/pyright#2987

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions