Skip to content

Commit

Permalink
bool.__new__ constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
randolf-scholz committed Nov 1, 2024
1 parent a4059c2 commit ac2cabd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ from _typeshed import (
SupportsAdd,
SupportsAiter,
SupportsAnext,
SupportsBool,
SupportsDivMod,
SupportsFlush,
SupportsIter,
Expand Down Expand Up @@ -908,7 +909,12 @@ class memoryview(Sequence[_I]):

@final
class bool(int):
def __new__(cls, o: object = ..., /) -> Self: ...
@overload
def __new__(cls) -> Literal[False]: ...
@overload
def __new__(cls, o: SupportsBool | Sized, /) -> bool: ...
@overload
def __new__(cls, o: object, /) -> Literal[True]: ...
# 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

0 comments on commit ac2cabd

Please sign in to comment.