mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[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:
parent
4b0c875d91
commit
37804149ec
4 changed files with 25 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue