Skip to content

Commit 5306d6f

Browse files
mistermochagvanrossum
authored andcommitted
Correct implementation of standard types besides "object" (#1340)
Per python/mypy#2989
1 parent 4a5ff0b commit 5306d6f

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

stdlib/2/typing.pyi

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ from types import CodeType, FrameType, TracebackType
99
overload = object()
1010
Any = object()
1111
TypeVar = object()
12-
Generic = object()
13-
Tuple = object()
14-
Callable = object()
15-
Type = object()
1612
_promote = object()
1713
no_type_check = object()
18-
ClassVar = object()
14+
15+
class _SpecialForm(object):
16+
def __getitem__(self, typeargs: Any) -> object: ...
17+
18+
Tuple: _SpecialForm = ...
19+
Generic: _SpecialForm = ...
20+
Callable: _SpecialForm = ...
21+
Type: _SpecialForm = ...
22+
ClassVar: _SpecialForm = ...
1923

2024
class GenericMeta(type): ...
2125

stdlib/3/typing.pyi

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ from types import CodeType, FrameType, TracebackType
1010
overload = object()
1111
Any = object()
1212
TypeVar = object()
13-
Generic = object()
14-
Tuple = object()
15-
Callable = object()
16-
Type = object()
1713
_promote = object()
1814
no_type_check = object()
19-
ClassVar = object()
15+
16+
class _SpecialForm:
17+
def __getitem__(self, typeargs: Any) -> Any: ...
18+
19+
Tuple: _SpecialForm = ...
20+
Generic: _SpecialForm = ...
21+
Callable: _SpecialForm = ...
22+
Type: _SpecialForm = ...
23+
ClassVar: _SpecialForm = ...
2024

2125
class GenericMeta(type): ...
2226

0 commit comments

Comments
 (0)