Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add __orig_bases__ to Generic #7827

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

Closed
Closed
Changes from all commits
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
10 changes: 8 additions & 2 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ class TypeVar:
_promote = object()

# N.B. Keep this definition in sync with typing_extensions._SpecialForm
@_final
class _SpecialForm:
def __getitem__(self, parameters: Any) -> object: ...
if sys.version_info >= (3, 10):
Expand All @@ -513,7 +512,14 @@ def overload(func: _F) -> _F: ...
# `_SpecialForm` objects in typing.py that are not used elswhere in the same file
# do not need the default value assignment.
Union: _SpecialForm = ...
Generic: _SpecialForm = ...

@_final
class _GenericSpecialForm(_SpecialForm):
# More precisely this is tuple[TypeForm, ...]
# https://github.com/python/mypy/issues/9773
__orig_bases__: ClassVar[tuple[type, ...]]

Generic: _GenericSpecialForm = ...
# Protocol is only present in 3.8 and later, but mypy needs it unconditionally
Protocol: _SpecialForm = ...
Callable: _SpecialForm = ...
Expand Down