Skip to content

Commit b0af550

Browse files
committed
fix: Generic definition
1 parent 85a787b commit b0af550

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

stdlib/typing.pyi

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ class _SpecialForm(_Final):
235235
def __ror__(self, other: Any) -> _SpecialForm: ...
236236

237237
Union: _SpecialForm
238-
Generic: _SpecialForm
239238
Protocol: _SpecialForm
240239
Callable: _SpecialForm
241240
Type: _SpecialForm
@@ -440,6 +439,14 @@ Annotated: _SpecialForm
440439
# Predefined type variables.
441440
AnyStr = TypeVar("AnyStr", str, bytes) # noqa: Y001
442441

442+
if sys.version_info >= (3, 12):
443+
class Generic:
444+
@classmethod
445+
def __class_getitem__(cls, args: TypeVar | ParamSpec | tuple[TypeVar | ParamSpec, ...]) -> _Final: ...
446+
else:
447+
# Dummy case; true definition accessible in typing
448+
Generic: _SpecialForm
449+
443450
class _ProtocolMeta(ABCMeta):
444451
if sys.version_info >= (3, 12):
445452
def __init__(cls, *args: Any, **kwargs: Any) -> None: ...

0 commit comments

Comments
 (0)