Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed typing_extensions.pyi to declare its own private version of Protocol #7133

Merged
merged 3 commits into from
Feb 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion stdlib/typing_extensions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ from typing import ( # noqa Y022
Mapping,
NewType as NewType,
NoReturn as NoReturn,
Protocol as Protocol,
Text as Text,
Type as Type,
TypeVar,
Expand All @@ -49,6 +48,13 @@ Self: _SpecialForm
Required: _SpecialForm
NotRequired: _SpecialForm

# Do not import (and re-export) Protocol from typing module because
# type checkers need to be able to distinguish typing.Protocol and
# typing_extensions.Protocol so they can properly warn users about
# potential runtime exceptions when using typing.Protocol on older
# versions of Python.
Protocol: _SpecialForm
JelleZijlstra marked this conversation as resolved.
Show resolved Hide resolved

def final(f: _F) -> _F: ...

Literal: _SpecialForm
Expand Down