mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-103590: do not wrap a single exception raised from a try-except* (#103665)
This commit is contained in:
parent
78942ecd9b
commit
63842bd907
4 changed files with 32 additions and 25 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue