From 1394a948a5ea49ecef1352d3db2a6358327d85f0 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Sat, 27 Jun 2026 15:39:08 +0800 Subject: [PATCH 1/3] commit --- stdlib/builtins.pyi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index fdd554c7fcd7..d75fcdd0836c 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1822,7 +1822,35 @@ def iter(object: Callable[[], _T], sentinel: object, /) -> Iterator[_T]: ... _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...] +@overload +def isinstance(obj: object, class_or_tuple: type[_T] | tuple[type[_T]], /) -> TypeIs[_T]: ... +@overload +def isinstance( + obj: object, class_or_tuple: tuple[type[_T], type[_T1]], / +) -> TypeIs[_T | _T1]: ... +@overload +def isinstance( + obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[T2]], / +) -> TypeIs[T | T1 | T2]: ... +@overload +def isinstance( + obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3]], / +) -> TypeIs[_T | _T1 | _T2 | _T3]: ... +@overload +def isinstance( + obj: object, + class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3], type[_T4]], + /, +) -> TypeIs[_T | _T1 | _T2 | _T3 | _T4]: ... +@overload +def isinstance( + obj: object, + class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3], type[_T4], type[_T5]], + /, +) -> TypeIs[_T | _T1 | _T2 | _T3 | _T4 | _T5]: ... +@overload def isinstance(obj: object, class_or_tuple: _ClassInfo, /) -> bool: ... + def issubclass(cls: type, class_or_tuple: _ClassInfo, /) -> bool: ... def len(obj: Sized, /) -> int: ... From 4f7d8c9bfd64efe9ba88c0bbb2a2a476de8d6554 Mon Sep 17 00:00:00 2001 From: Jonathan Dung Date: Sat, 27 Jun 2026 15:42:22 +0800 Subject: [PATCH 2/3] hotfix --- stdlib/builtins.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index d75fcdd0836c..29e5e0e099fb 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1830,8 +1830,8 @@ def isinstance( ) -> TypeIs[_T | _T1]: ... @overload def isinstance( - obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[T2]], / -) -> TypeIs[T | T1 | T2]: ... + obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[_T2]], / +) -> TypeIs[_T | _T1 | _T2]: ... @overload def isinstance( obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3]], / From 64d54c4efadc933a5547ac9cb52b32cb9bdb4a20 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 27 Jun 2026 07:44:52 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/builtins.pyi | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 29e5e0e099fb..4988594f6c18 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1825,28 +1825,20 @@ _ClassInfo: TypeAlias = type | types.UnionType | tuple[_ClassInfo, ...] @overload def isinstance(obj: object, class_or_tuple: type[_T] | tuple[type[_T]], /) -> TypeIs[_T]: ... @overload -def isinstance( - obj: object, class_or_tuple: tuple[type[_T], type[_T1]], / -) -> TypeIs[_T | _T1]: ... +def isinstance(obj: object, class_or_tuple: tuple[type[_T], type[_T1]], /) -> TypeIs[_T | _T1]: ... @overload -def isinstance( - obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[_T2]], / -) -> TypeIs[_T | _T1 | _T2]: ... +def isinstance(obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[_T2]], /) -> TypeIs[_T | _T1 | _T2]: ... @overload def isinstance( obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3]], / ) -> TypeIs[_T | _T1 | _T2 | _T3]: ... @overload def isinstance( - obj: object, - class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3], type[_T4]], - /, + obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3], type[_T4]], / ) -> TypeIs[_T | _T1 | _T2 | _T3 | _T4]: ... @overload def isinstance( - obj: object, - class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3], type[_T4], type[_T5]], - /, + obj: object, class_or_tuple: tuple[type[_T], type[_T1], type[_T2], type[_T3], type[_T4], type[_T5]], / ) -> TypeIs[_T | _T1 | _T2 | _T3 | _T4 | _T5]: ... @overload def isinstance(obj: object, class_or_tuple: _ClassInfo, /) -> bool: ...