gh-103590: do not wrap a single exception raised from a try-except* (#103665)
This commit is contained in:
@@ -1421,7 +1421,12 @@ _PyExc_PrepReraiseStar(PyObject *orig, PyObject *excs)
|
||||
if (res < 0) {
|
||||
goto done;
|
||||
}
|
||||
result = _PyExc_CreateExceptionGroup("", raised_list);
|
||||
if (PyList_GET_SIZE(raised_list) > 1) {
|
||||
result = _PyExc_CreateExceptionGroup("", raised_list);
|
||||
}
|
||||
else {
|
||||
result = Py_NewRef(PyList_GetItem(raised_list, 0));
|
||||
}
|
||||
if (result == NULL) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user