Skip to content

Commit 79ed469

Browse files
committed
Avoid side effects in macro
1 parent 9e11cc7 commit 79ed469

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Objects/frameobject.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,15 +1813,16 @@ frame_lineno_set_impl(PyFrameObject *self, PyObject *value)
18131813
start_stack = pop_value(start_stack);
18141814
}
18151815
while (start_stack > best_stack) {
1816+
_PyStackRef popped = _PyFrame_StackPop(self->f_frame);
18161817
if (top_of_stack(start_stack) == Except) {
18171818
/* Pop exception stack as well as the evaluation stack */
1818-
PyObject *exc = PyStackRef_AsPyObjectBorrow(_PyFrame_StackPop(self->f_frame));
1819+
PyObject *exc = PyStackRef_AsPyObjectBorrow(popped);
18191820
assert(PyExceptionInstance_Check(exc) || exc == Py_None);
18201821
PyThreadState *tstate = _PyThreadState_GET();
18211822
Py_XSETREF(tstate->exc_info->exc_value, exc == Py_None ? NULL : exc);
18221823
}
18231824
else {
1824-
PyStackRef_XCLOSE(_PyFrame_StackPop(self->f_frame));
1825+
PyStackRef_XCLOSE(popped);
18251826
}
18261827
start_stack = pop_value(start_stack);
18271828
}

0 commit comments

Comments
 (0)