summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-11-06 15:45:33 (GMT)
committerGitHub <noreply@github.com>2023-11-06 15:45:33 (GMT)
commitc5063fd62a3fd3c5c2af33fc17c60fabe54282fe (patch)
tree23f2255d2a719d41ff4f37ca54dd38291edb63fc /Objects
parent5e5762a2b8c6d341ebe156812e28bea78128207d (diff)
downloadcpython-c5063fd62a3fd3c5c2af33fc17c60fabe54282fe.zip
cpython-c5063fd62a3fd3c5c2af33fc17c60fabe54282fe.tar.gz
cpython-c5063fd62a3fd3c5c2af33fc17c60fabe54282fe.tar.bz2
simplify code to pop exception in frame_setlineno (#111702)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/frameobject.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 3b72651..3a10f62 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -808,13 +808,10 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno, void *Py_UNUSED(ignore
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);