Skip to content
Open
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
13 changes: 12 additions & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -950,9 +950,20 @@ class memoryview(Sequence[_I]):
if sys.version_info >= (3, 14):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...

class _Truthy(Protocol):
def __bool__(self) -> Literal[True]: ...

class _Falsy(Protocol):
def __bool__(self) -> Literal[False]: ...

@final
class bool(int):
def __new__(cls, o: object = False, /) -> Self: ...
@overload
def __new__(cls, o: _Truthy, /) -> Literal[True]: ...
@overload
def __new__(cls, o: _Falsy = False, /) -> Literal[False]: ...
@overload
def __new__(cls, o: object, /) -> Self: ...
# The following overloads could be represented more elegantly with a TypeVar("_B", bool, int),
# however mypy has a bug regarding TypeVar constraints (https://github.com/python/mypy/issues/11880).
@overload
Expand Down
Loading