Skip to content

Commit 9997c01

Browse files
committed
Refactor goto error into return NULL within BaseExceptionGroup_repr()
1 parent 5353340 commit 9997c01

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Objects/exceptions.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ BaseExceptionGroup_repr(PyObject *op)
11001100
if (PyList_Check(PyTuple_GET_ITEM(self->args, 1))) {
11011101
PyObject *exceptions_list = PySequence_List(self->excs);
11021102
if (!exceptions_list) {
1103-
goto error;
1103+
return NULL;
11041104
}
11051105

11061106
exceptions_str = PyObject_Repr(exceptions_list);
@@ -1111,7 +1111,7 @@ BaseExceptionGroup_repr(PyObject *op)
11111111
}
11121112

11131113
if (!exceptions_str) {
1114-
goto error;
1114+
return NULL;
11151115
}
11161116
} else {
11171117
exceptions_str = Py_NewRef(self->excs_str);
@@ -1126,8 +1126,6 @@ BaseExceptionGroup_repr(PyObject *op)
11261126

11271127
Py_DECREF(exceptions_str);
11281128
return repr;
1129-
error:
1130-
return NULL;
11311129
}
11321130

11331131
/*[clinic input]

0 commit comments

Comments
 (0)