Skip to content

Commit ac2cabd

Browse files
bool.__new__ constructors
1 parent a4059c2 commit ac2cabd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

stdlib/builtins.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ from _typeshed import (
1919
SupportsAdd,
2020
SupportsAiter,
2121
SupportsAnext,
22+
SupportsBool,
2223
SupportsDivMod,
2324
SupportsFlush,
2425
SupportsIter,
@@ -908,7 +909,12 @@ class memoryview(Sequence[_I]):
908909

909910
@final
910911
class bool(int):
911-
def __new__(cls, o: object = ..., /) -> Self: ...
912+
@overload
913+
def __new__(cls) -> Literal[False]: ...
914+
@overload
915+
def __new__(cls, o: SupportsBool | Sized, /) -> bool: ...
916+
@overload
917+
def __new__(cls, o: object, /) -> Literal[True]: ...
912918
# The following overloads could be represented more elegantly with a TypeVar("_B", bool, int),
913919
# however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880).
914920
@overload

0 commit comments

Comments
 (0)