]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] docs: fix f-string in ExceptionGroup example (GH-146108) (GH-146126)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 23 Mar 2026 23:09:00 +0000 (00:09 +0100)
committerGitHub <noreply@github.com>
Mon, 23 Mar 2026 23:09:00 +0000 (00:09 +0100)
(cherry picked from commit 2c6afb935ad588f32cb969345d0345e45d3a766e)

Co-authored-by: Bartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
Doc/tutorial/errors.rst

index ae21dfdbf0ac444dcb99fc73a736bb3543369455..3c6edf2c4793abd7450416aff3362cf65fd59e6d 100644 (file)
@@ -549,9 +549,9 @@ caught like any other exception. ::
    >>> try:
    ...     f()
    ... except Exception as e:
-   ...     print(f'caught {type(e)}: e')
+   ...     print(f'caught {type(e)}: {e}')
    ...
-   caught <class 'ExceptionGroup'>: e
+   caught <class 'ExceptionGroup'>: there were problems (2 sub-exceptions)
    >>>
 
 By using ``except*`` instead of ``except``, we can selectively