Skip to content
Open
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
4 changes: 2 additions & 2 deletions Doc/library/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ their subgroups based on the types of the contained exceptions.
... def derive(self, excs):
... return MyGroup(self.message, excs)
...
>>> e = MyGroup("eg", [ValueError(1), TypeError(2)])
>>> e = MyGroup("eg", (ValueError(1), TypeError(2)))
>>> e.add_note("a note")
>>> e.__context__ = Exception("context")
>>> e.__cause__ = Exception("cause")
Expand All @@ -1059,7 +1059,7 @@ their subgroups based on the types of the contained exceptions.
...
>>> match, rest = exc.split(ValueError)
>>> exc, exc.__context__, exc.__cause__, exc.__notes__
(MyGroup('eg', [ValueError(1), TypeError(2)]), Exception('context'), Exception('cause'), ['a note'])
(MyGroup('eg', (ValueError(1), TypeError(2))), Exception('context'), Exception('cause'), ['a note'])
>>> match, match.__context__, match.__cause__, match.__notes__
(MyGroup('eg', [ValueError(1)]), Exception('context'), Exception('cause'), ['a note'])
>>> rest, rest.__context__, rest.__cause__, rest.__notes__
Expand Down
4 changes: 2 additions & 2 deletions Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ is merged with any exceptions that were raised or re-raised from within

>>> try:
... raise ExceptionGroup("eg",
... [ValueError(1), TypeError(2), OSError(3), OSError(4)])
... (ValueError(1), TypeError(2), OSError(3), OSError(4)))
... except* TypeError as e:
... print(f'caught {type(e)} with nested {e.exceptions}')
... except* OSError as e:
Expand All @@ -372,7 +372,7 @@ is merged with any exceptions that were raised or re-raised from within
+ Exception Group Traceback (most recent call last):
| File "<doctest default[0]>", line 2, in <module>
| raise ExceptionGroup("eg",
| [ValueError(1), TypeError(2), OSError(3), OSError(4)])
| (ValueError(1), TypeError(2), OSError(3), OSError(4)))
| ExceptionGroup: eg (1 sub-exception)
+-+---------------- 1 ----------------
| ValueError: 1
Expand Down
12 changes: 6 additions & 6 deletions Doc/tutorial/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,12 @@ tasks may have failed in parallel, but there are also other use cases where
it is desirable to continue execution and collect multiple errors rather than
raise the first exception.

The builtin :exc:`ExceptionGroup` wraps a list of exception instances so
The builtin :exc:`ExceptionGroup` wraps a sequence of exception instances so
that they can be raised together. It is an exception itself, so it can be
caught like any other exception. ::

>>> def f():
... excs = [OSError('error 1'), SystemError('error 2')]
... excs = (OSError('error 1'), SystemError('error 2'))
... raise ExceptionGroup('there were problems', excs)
...
>>> f()
Expand Down Expand Up @@ -564,17 +564,17 @@ other clauses and eventually to be reraised. ::
>>> def f():
... raise ExceptionGroup(
... "group1",
... [
... (
... OSError(1),
... SystemError(2),
... ExceptionGroup(
... "group2",
... [
... (
... OSError(3),
... RecursionError(4)
... ]
... )
... )
... ]
... )
... )
...
>>> try:
Expand Down
Loading