[3.12] gh-103791: handle BaseExceptionGroup in contextlib.suppress() (GH-111910) (#111955)

gh-103791: handle `BaseExceptionGroup` in `contextlib.suppress()` (GH-111910)
(cherry picked from commit d61313bdb1)

Co-authored-by: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-11-10 15:00:48 +01:00 committed by GitHub
parent 4b0c875d91
commit 37804149ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 4 deletions

View file

@ -457,7 +457,7 @@ class suppress(AbstractContextManager):
return
if issubclass(exctype, self._exceptions):
return True
if issubclass(exctype, ExceptionGroup):
if issubclass(exctype, BaseExceptionGroup):
match, rest = excinst.split(self._exceptions)
if rest is None:
return True