[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.
This commit is contained in:
Irit Katriel 2021-11-05 14:44:04 +00:00 committed by GitHub
parent 00cb14dd23
commit 0098f08851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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,