From 232d87b07ac463672514c6efcca6235e47c28ced Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Fri, 12 Aug 2022 19:40:54 +0100 Subject: [PATCH 1/8] gh-95914: add paragraph about pep 654 in main body of 'what's new in 3.11' --- Doc/whatsnew/3.11.rst | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 41aa6944395f42..25ca04eb7028ab 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -176,14 +176,33 @@ The :option:`-X` ``no_debug_ranges`` option and the environment variable See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan Taskaya and Ammar Askar in :issue:`43950`.) +Exception Groups and ``except*`` (PEP 654) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:pep:`654` introduces language features that enable a program +to raise and handle multiple unrelated exceptions simultaneously. +The builtin types :exc:`ExceptionGroup` and :exc:`BaseExceptionGroup` +make it possible to group exceptions and raise them together. +The new ``except*`` syntax generalizes ``except`` to match subgroups +of exception groups. + +See :pep:`654` for more details. + +(Contributed by Irit Katriel in :issue:`45292`. PEP written by +Irit Katriel, Yury Selivanov and Guido van Rossum.) + Exceptions can be enriched with notes (PEP 678) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The :meth:`add_note` method was added to :exc:`BaseException`. It can be used to enrich exceptions with context information which is not available at the time when the exception is raised. The notes added appear in the -default traceback. See :pep:`678` for more details. (Contributed by -Irit Katriel in :issue:`45607`.) +default traceback. + +See :pep:`678` for more details. + +(Contributed by Irit Katriel in :issue:`45607`. PEP written by +Zac Hatfield-Dodds.) .. _new-feat-related-type-hints-311: From 6953ebaa2feb8b7b4cf70b6762715b1631c61de1 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sat, 13 Aug 2022 12:18:45 +0100 Subject: [PATCH 2/8] whitespace Co-authored-by: CAM Gerlach --- Doc/whatsnew/3.11.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 25ca04eb7028ab..fe5eb5ad967051 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -176,6 +176,7 @@ The :option:`-X` ``no_debug_ranges`` option and the environment variable See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan Taskaya and Ammar Askar in :issue:`43950`.) + Exception Groups and ``except*`` (PEP 654) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 87d77c4d35a530ce1fe31739288e03629078a6bd Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sat, 13 Aug 2022 12:19:01 +0100 Subject: [PATCH 3/8] heading Co-authored-by: CAM Gerlach --- Doc/whatsnew/3.11.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index fe5eb5ad967051..378aa8414ecc3d 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -178,7 +178,7 @@ and Ammar Askar in :issue:`43950`.) Exception Groups and ``except*`` (PEP 654) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------------------------ :pep:`654` introduces language features that enable a program to raise and handle multiple unrelated exceptions simultaneously. From e18ee3cbdff1cf11e6b9295491bb588a9f56e82e Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sat, 13 Aug 2022 12:20:00 +0100 Subject: [PATCH 4/8] whitespace Co-authored-by: CAM Gerlach --- Doc/whatsnew/3.11.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 378aa8414ecc3d..f734df5e82bbd1 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -192,6 +192,7 @@ See :pep:`654` for more details. (Contributed by Irit Katriel in :issue:`45292`. PEP written by Irit Katriel, Yury Selivanov and Guido van Rossum.) + Exceptions can be enriched with notes (PEP 678) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 4b13c09e69c6b8c16f05541b7bb9b1f7a4669fe3 Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Sat, 13 Aug 2022 12:21:27 +0100 Subject: [PATCH 5/8] :keyword: Co-authored-by: CAM Gerlach --- Doc/whatsnew/3.11.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index f734df5e82bbd1..157b9617ee8019 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -183,8 +183,9 @@ Exception Groups and ``except*`` (PEP 654) :pep:`654` introduces language features that enable a program to raise and handle multiple unrelated exceptions simultaneously. The builtin types :exc:`ExceptionGroup` and :exc:`BaseExceptionGroup` -make it possible to group exceptions and raise them together. -The new ``except*`` syntax generalizes ``except`` to match subgroups +make it possible to group exceptions and raise them together, +and the new :keyword:`except* ` syntax +generalizes :keyword:`except` to match subgroups of exception groups. See :pep:`654` for more details. From dd2861378be61fb62d949dc665b6f98dce1959dc Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sat, 13 Aug 2022 12:27:35 +0100 Subject: [PATCH 6/8] revert PEP-678 changes. Update titles --- Doc/whatsnew/3.11.rst | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 157b9617ee8019..67203b620e025c 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -177,8 +177,8 @@ See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan Taskaya and Ammar Askar in :issue:`43950`.) -Exception Groups and ``except*`` (PEP 654) ------------------------------------------- +PEP 654: Exception Groups and ``except*`` +----------------------------------------- :pep:`654` introduces language features that enable a program to raise and handle multiple unrelated exceptions simultaneously. @@ -194,18 +194,14 @@ See :pep:`654` for more details. Irit Katriel, Yury Selivanov and Guido van Rossum.) -Exceptions can be enriched with notes (PEP 678) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +PEP 678: Exceptions can be enriched with notes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The :meth:`add_note` method was added to :exc:`BaseException`. It can be used to enrich exceptions with context information which is not available at the time when the exception is raised. The notes added appear in the -default traceback. - -See :pep:`678` for more details. - -(Contributed by Irit Katriel in :issue:`45607`. PEP written by -Zac Hatfield-Dodds.) +default traceback. See :pep:`678` for more details. (Contributed by +Irit Katriel in :issue:`45607`.) .. _new-feat-related-type-hints-311: From c64a0476b1c04d853b9cd4d193a32219cc5a673b Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sat, 13 Aug 2022 12:28:30 +0100 Subject: [PATCH 7/8] whitespace --- Doc/whatsnew/3.11.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 67203b620e025c..2d19468c85f00e 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -200,7 +200,7 @@ PEP 678: Exceptions can be enriched with notes The :meth:`add_note` method was added to :exc:`BaseException`. It can be used to enrich exceptions with context information which is not available at the time when the exception is raised. The notes added appear in the -default traceback. See :pep:`678` for more details. (Contributed by +default traceback. See :pep:`678` for more details. (Contributed by Irit Katriel in :issue:`45607`.) From 602fdc94bd305369da8b9c7e4a03405fe3cf67f9 Mon Sep 17 00:00:00 2001 From: Irit Katriel Date: Sat, 13 Aug 2022 12:29:38 +0100 Subject: [PATCH 8/8] whitespace --- Doc/whatsnew/3.11.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 2d19468c85f00e..637d12b61e7f90 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -184,9 +184,8 @@ PEP 654: Exception Groups and ``except*`` to raise and handle multiple unrelated exceptions simultaneously. The builtin types :exc:`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible to group exceptions and raise them together, -and the new :keyword:`except* ` syntax -generalizes :keyword:`except` to match subgroups -of exception groups. +and the new :keyword:`except* ` syntax generalizes +:keyword:`except` to match subgroups of exception groups. See :pep:`654` for more details.