diff --git a/pep-0654.rst b/pep-0654.rst index 5f04667b6..a82cd1f75 100644 --- a/pep-0654.rst +++ b/pep-0654.rst @@ -143,7 +143,7 @@ and ``try: ... except BaseExceptionGroup: ...``. Both have a constructor that takes two positional-only arguments: a message string and a sequence of the nested exceptions, which are exposed in the -fields ``message`` and ``errors``. For example: +fields ``message`` and ``exceptions``. For example: ``ExceptionGroup('issues', [ValueError('bad value'), TypeError('bad type')])``. The difference between them is that ``ExceptionGroup`` can only wrap ``Exception`` subclasses while ``BaseExceptionGroup`` can wrap any @@ -383,7 +383,7 @@ recursively, as follows: tbs.append(exc.__traceback__) if isinstance(exc, ExceptionGroup): - for e in exc.errors: + for e in exc.exceptions: yield from leaf_generator(e, tbs) else: # exc is a leaf exception and its traceback @@ -491,7 +491,7 @@ Exceptions are matched using a subclass check. For example: try: low_level_os_operation() except *OSError as eg: - for e in eg.errors: + for e in eg.exceptions: print(type(e).__name__) could output: