bpo-46107: ExceptionGroup.subgroup()/split() should copy __note__ to the parts (GH-30159)

This commit is contained in:
Irit Katriel 2021-12-21 10:12:26 +00:00 committed by GitHub
parent e9a01e231a
commit c66fc0fb53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View file

@ -901,6 +901,11 @@ exceptiongroup_subset(
}
PyException_SetContext(eg, PyException_GetContext(orig));
PyException_SetCause(eg, PyException_GetCause(orig));
PyObject *note = _PyBaseExceptionObject_cast(orig)->note;
Py_XINCREF(note);
_PyBaseExceptionObject_cast(eg)->note = note;
*result = eg;
return 0;
error: