Closed
Description
The documentation for BaseExceptionGroup.derive
says "Returns an exception group with the same message, __traceback__
, __cause__
, __context__
and __notes__
but which wraps the exceptions in excs."
But it doesn't, it only preserves the message:
Python 3.11.0 (v3.11.0:deaf509e8f, Oct 24 2022, 14:43:23) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> eg = BaseExceptionGroup("", [ValueError("included")])
>>> eg.add_note("note")
>>> eg.__cause__ = ValueError("cause")
>>> eg.__context__ = ValueError("context")
>>> derived = eg.derive([ValueError("derive")])
>>> derived.__notes__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'ExceptionGroup' object has no attribute '__notes__'. Did you mean: '__ne__'?
>>> derived.__cause__
derived.__cause__
>>> derived.__cause__
>>> derived.__context__
>>> derived.message
''
The code for BaseExceptionGroup.derive
only uses self->msg
from the original object:
Line 860 in b0e1f9c
cc @iritkatriel @Zac-HD for exceptiongroups and notes.