Skip to content
Closed
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
7 changes: 7 additions & 0 deletions mypy/typeshed/stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ _NegativeInteger: TypeAlias = Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -
_LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed

class int:
@overload
def __new__(cls, /) -> Literal[0]: ...
@overload
def __new__(cls, x: ConvertibleToInt = ..., /) -> Self: ...
@overload
Expand Down Expand Up @@ -458,6 +460,8 @@ class _TranslateTable(Protocol):
def __getitem__(self, key: int, /) -> str | int | None: ...

class str(Sequence[str]):
@overload
def __new__(cls) -> Literal[""]: ...
@overload
def __new__(cls, object: object = ...) -> Self: ...
@overload
Expand Down Expand Up @@ -834,6 +838,9 @@ class memoryview(Sequence[_I]):

@final
class bool(int):
@overload
def __new__(cls, /) -> 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).
Expand Down
Loading