From fdad609688f215ef043085aa89366e72928b77ee Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 21 Dec 2021 22:24:32 -0800 Subject: [PATCH 1/2] add (Base)ExceptionGroup --- stdlib/builtins.pyi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index c8f32b2dca0e..0048c71c1465 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1651,3 +1651,19 @@ class ResourceWarning(Warning): ... if sys.version_info >= (3, 10): class EncodingWarning(Warning): ... + +if sys.version_info >= (3, 11): + _SplitCondition = type[BaseException] | tuple[type[BaseException, ...]] | Callable[[BaseException], bool] + class BaseExceptionGroup(BaseException): + def __new__(cls, __message: str, exceptions: Sequence[BaseException]) -> BaseExceptionGroup | ExceptionGroup: ... + @property + def message(self) -> str: ... + @property + def exceptions(self) -> Sequence[BaseException]: ... + def subgroup(self: Self, __condition: _SplitCondition) -> Self | None: ... + def split(self: Self, __condition: _SplitCondition) -> tuple[Self | None, Self | None]: ... + def derive(self: Self, __excs: Sequence[BaseException]) -> Self: ... + class ExceptionGroup(BaseExceptionGroup, Exception): + def __new__(cls, __message: str, exceptions: Sequence[Exception]) -> ExceptionGroup: ... + @property + def exceptions(self) -> Sequence[Exception]: ... From a2104bf3512ce9d24d8af6224b9d5ad1baabd035 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 22 Dec 2021 07:46:15 -0800 Subject: [PATCH 2/2] Update stdlib/builtins.pyi Co-authored-by: Sebastian Rittau --- stdlib/builtins.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 0048c71c1465..d950204b8380 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1655,7 +1655,7 @@ if sys.version_info >= (3, 10): if sys.version_info >= (3, 11): _SplitCondition = type[BaseException] | tuple[type[BaseException, ...]] | Callable[[BaseException], bool] class BaseExceptionGroup(BaseException): - def __new__(cls, __message: str, exceptions: Sequence[BaseException]) -> BaseExceptionGroup | ExceptionGroup: ... + def __new__(cls, __message: str, __exceptions: Sequence[BaseException]) -> BaseExceptionGroup | ExceptionGroup: ... @property def message(self) -> str: ... @property