while (start_stack > best_stack) {
if (top_of_stack(start_stack) == Except) {
/* Pop exception stack as well as the evaluation stack */
- PyThreadState *tstate = _PyThreadState_GET();
- _PyErr_StackItem *exc_info = tstate->exc_info;
- PyObject *value = exc_info->exc_value;
PyObject *exc = _PyFrame_StackPop(f->f_frame);
assert(PyExceptionInstance_Check(exc) || exc == Py_None);
- exc_info->exc_value = exc;
- Py_XDECREF(value);
+ PyThreadState *tstate = _PyThreadState_GET();
+ Py_XSETREF(tstate->exc_info->exc_value, exc);
}
else {
PyObject *v = _PyFrame_StackPop(f->f_frame);