Skip to content

Add @typing_extensions.solid_base #14443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ from typing_extensions import ( # noqa: Y023
TypeIs,
TypeVarTuple,
deprecated,
solid_base,
)

if sys.version_info >= (3, 14):
Expand Down Expand Up @@ -241,6 +242,7 @@ _PositiveInteger: TypeAlias = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
_NegativeInteger: TypeAlias = Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20]
_LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed

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

@solid_base
class str(Sequence[str]):
@overload
def __new__(cls, object: object = ...) -> Self: ...
Expand Down
2 changes: 2 additions & 0 deletions stdlib/typing_extensions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -700,3 +700,5 @@ class Sentinel:
elif sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ... # other can be any type form legal for unions
def __ror__(self, other: Any) -> _SpecialForm: ... # other can be any type form legal for unions

def solid_base(arg: _F, /) -> _F: ...
Loading