From 251b58ee76d668218c65e52a04126f1408d6e16f 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 096d440ac38c..c02e206c7bad 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1821,7 +1821,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 f751531e2caf73376c42ae95b52fac7a106ec77c 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 c02e206c7bad..8c46c650478a 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1829,8 +1829,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 740e917bd0ac62072d1587ddad2e7ae65eb4f821 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 8c46c650478a..c227d8e7ee29 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1824,28 +1824,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: ...