Skip to content

Commit c3ddd3c

Browse files
author
Guido van Rossum
committed
Improve __subclasses__() signature. Fixes #2236.
1 parent cb97bb5 commit c3ddd3c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

stdlib/2/__builtin__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Python 3, and stub files conform to Python 3 syntax.
55

66
from typing import (
7-
TypeVar, Iterator, Iterable, overload,
7+
TypeVar, Iterator, Iterable, overload, Type,
88
Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
99
AbstractSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
1010
SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
@@ -60,7 +60,7 @@ class type:
6060
# Note: the documentation doesnt specify what the return type is, the standard
6161
# implementation seems to be returning a list.
6262
def mro(self) -> List[type]: ...
63-
def __subclasses__(self) -> List[type]: ...
63+
def __subclasses__(self: Type[_T]) -> List[Type[_T]]: ...
6464

6565
class int(SupportsInt, SupportsFloat, SupportsAbs[int]):
6666
@overload

stdlib/3/builtins.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Stubs for builtins (Python 3)
22

33
from typing import (
4-
TypeVar, Iterator, Iterable, overload,
4+
TypeVar, Iterator, Iterable, overload, Type,
55
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
66
Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsBytes,
77
SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString, Optional
@@ -57,7 +57,7 @@ class type:
5757
@overload
5858
def __new__(cls, name: str, bases: Tuple[type, ...], namespace: Dict[str, Any]) -> type: ...
5959
def __call__(self, *args: Any, **kwds: Any) -> Any: ...
60-
def __subclasses__(self) -> List[type]: ...
60+
def __subclasses__(self: Type[_T]) -> List[Type[_T]]: ...
6161
# Note: the documentation doesnt specify what the return type is, the standard
6262
# implementation seems to be returning a list.
6363
def mro(self) -> List[type]: ...

0 commit comments

Comments
 (0)