-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir
Description
Bug report
Bug description:
from contextlib import suppress
class FooException(Exception): ...
class FooExceptionGroup(ExceptionGroup[Exception]): ...
try:
with suppress(FooException):
raise FooExceptionGroup("", [Exception()])
except ExceptionGroup as e:
print(type(e))in this code, the suppress context manager is expected to have no effect, as a FooException is not being raised within it. instead, it gets converted to an ExceptionGroup then re-raised.
expected output:
<class '__main__.FooExceptionGroup'>
actual output:
<class 'ExceptionGroup'>
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Linked PRs
- gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress #119657
- [3.13] gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress (GH-119657) #120105
- [3.12] gh-119287: clarify doc on BaseExceptionGroup.derive and link to it from contextlib.suppress (GH-119657) #120106
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dir