From 0098f08851cc9be825e4d646e424175cb345122a Mon Sep 17 00:00:00 2001 From: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Date: Fri, 5 Nov 2021 14:44:04 +0000 Subject: [PATCH] [PEP-654] add None check in subgroup example (GH-2132) Joe Gottman alerted us to an error in this example, which is missing a None check. --- pep-0654.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pep-0654.rst b/pep-0654.rst index a7a547d81..ecb8a2967 100644 --- a/pep-0654.rst +++ b/pep-0654.rst @@ -1023,7 +1023,9 @@ OS errors, while letting all other exceptions propagate. try: low_level_os_operation() except* OSError as errors: - raise errors.subgroup(lambda e: e.errno != errno.EPIPE) from None + exc = errors.subgroup(lambda e: e.errno != errno.EPIPE) + if exc is not None: + raise exc from None Caught Exception Objects @@ -1478,7 +1480,7 @@ ways, both the design and the exposition. For this we appreciate all those who contributed ideas and asked good questions: Ammar Askar, Matthew Barnett, Ran Benita, Emily Bowman, Brandt Bucher, Joao Bueno, Baptiste Carvello, Rob Cliffe, Nick Coghlan, Steven D'Aprano, Caleb Donovick, Steve Dower, -Greg Ewing, Ethan Furman, Pablo Salgado, Jonathan Goble, Thomas Grainger, +Greg Ewing, Ethan Furman, Pablo Salgado, Jonathan Goble, Joe Gottman, Thomas Grainger, Larry Hastings, Zac Hatfield-Dodds, Chris Jerdonek, Jim Jewett, Sven Kunze, Ɓukasz Langa, Glenn Linderman, Paul Moore, Antoine Pitrou, Ivan Pozdeev, Patrick Reader, Terry Reedy, Sascha Schlemmer, Barry Scott, Mark Shannon,