File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1100,6 +1100,10 @@ BaseExceptionGroup_repr(PyObject *op)
11001100 * original exception sequence if possible, for backwards compatibility. */
11011101 if (PyList_Check (PyTuple_GET_ITEM (self -> args , 1 ))) {
11021102 PyObject * exceptions_list = PySequence_List (self -> excs );
1103+ if (!exceptions_list ) {
1104+ goto error ;
1105+ }
1106+
11031107 exceptions_str = PyObject_Repr (exceptions_list );
11041108 Py_DECREF (exceptions_list );
11051109 }
@@ -1108,13 +1112,19 @@ BaseExceptionGroup_repr(PyObject *op)
11081112 }
11091113 }
11101114
1115+ if (!exceptions_str ) {
1116+ goto error ;
1117+ }
1118+
11111119 const char * name = _PyType_Name (Py_TYPE (self ));
11121120 PyObject * repr = PyUnicode_FromFormat (
11131121 "%s(%R, %U)" , name ,
11141122 self -> msg , exceptions_str );
11151123
11161124 Py_DECREF (exceptions_str );
11171125 return repr ;
1126+ error :
1127+ return NULL ;
11181128}
11191129
11201130/*[clinic input]
You can’t perform that action at this time.
0 commit comments