Skip to content

Commit b045381

Browse files
add (Base)ExceptionGroup (#6655)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
1 parent 426ce06 commit b045381

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

stdlib/builtins.pyi

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,3 +1651,19 @@ class ResourceWarning(Warning): ...
16511651

16521652
if sys.version_info >= (3, 10):
16531653
class EncodingWarning(Warning): ...
1654+
1655+
if sys.version_info >= (3, 11):
1656+
_SplitCondition = type[BaseException] | tuple[type[BaseException, ...]] | Callable[[BaseException], bool]
1657+
class BaseExceptionGroup(BaseException):
1658+
def __new__(cls, __message: str, __exceptions: Sequence[BaseException]) -> BaseExceptionGroup | ExceptionGroup: ...
1659+
@property
1660+
def message(self) -> str: ...
1661+
@property
1662+
def exceptions(self) -> Sequence[BaseException]: ...
1663+
def subgroup(self: Self, __condition: _SplitCondition) -> Self | None: ...
1664+
def split(self: Self, __condition: _SplitCondition) -> tuple[Self | None, Self | None]: ...
1665+
def derive(self: Self, __excs: Sequence[BaseException]) -> Self: ...
1666+
class ExceptionGroup(BaseExceptionGroup, Exception):
1667+
def __new__(cls, __message: str, exceptions: Sequence[Exception]) -> ExceptionGroup: ...
1668+
@property
1669+
def exceptions(self) -> Sequence[Exception]: ...

0 commit comments

Comments
 (0)