You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
Apologies for causing the regression @erictraut (it was my PR IIRC).
Seems like it should be added back to typing_extensions along with a comment explaining why it's duplicated there from typing rather than being re-exported, even though it's available in typing unconditionally (from typeshed's POV — at runtime, it obviously can only be imported from typing in 3.8+).
Until recently,
typing_extensions.pyi
declared its ownProtocol
symbol as follows:It now directly imports
Protocol
fromtyping.pyi
and re-exports this symbol. This means pyright can no longer differentiate between the two symbols. There's an important difference becausetyping.Protocol
will generate a runtime exception if used in versions of Python prior to 3.7, buttyping_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
The text was updated successfully, but these errors were encountered: