Skip to content

Commit d61e6b9

Browse files
committed
Swap order of if-else branches and clarify comment in BaseExceptionGroup_repr()
1 parent 9cba6b6 commit d61e6b9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Objects/exceptions.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,11 @@ BaseExceptionGroup_repr(PyObject *op)
10881088

10891089
PyObject *exceptions_str = NULL;
10901090

1091-
/* If the initial exceptions string was not saved in the constructor. */
1092-
if (!self->excs_str) {
1091+
/* Use the saved exceptions string for custom sequences. */
1092+
if (self->excs_str) {
1093+
exceptions_str = Py_NewRef(self->excs_str);
1094+
}
1095+
else {
10931096
assert(self->excs);
10941097

10951098
/* Older versions delegated to BaseException, inserting the current
@@ -1113,9 +1116,6 @@ BaseExceptionGroup_repr(PyObject *op)
11131116
return NULL;
11141117
}
11151118
}
1116-
else {
1117-
exceptions_str = Py_NewRef(self->excs_str);
1118-
}
11191119

11201120
assert(exceptions_str != NULL);
11211121

0 commit comments

Comments
 (0)