summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-12-06 14:01:38 (GMT)
committerGitHub <noreply@github.com>2022-12-06 14:01:38 (GMT)
commitb72014c783e5698beb18ee1249597e510b8bcb5a (patch)
tree348e6b38b80f9ec04a12f94d99c1199ebaa75c1c /Python/bytecodes.c
parent85d5a7e8ef472a4a64e5de883cf313c111a8ec77 (diff)
downloadcpython-b72014c783e5698beb18ee1249597e510b8bcb5a.zip
cpython-b72014c783e5698beb18ee1249597e510b8bcb5a.tar.gz
cpython-b72014c783e5698beb18ee1249597e510b8bcb5a.tar.bz2
GH-99729: Unlink frames before clearing them (GH-100030)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 41dd1ac..d0480ac 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -619,7 +619,10 @@ dummy_func(
DTRACE_FUNCTION_EXIT();
_Py_LeaveRecursiveCallPy(tstate);
assert(frame != &entry_frame);
- frame = cframe.current_frame = pop_frame(tstate, frame);
+ // GH-99729: We need to unlink the frame *before* clearing it:
+ _PyInterpreterFrame *dying = frame;
+ frame = cframe.current_frame = dying->previous;
+ _PyEvalFrameClearAndPop(tstate, dying);
_PyFrame_StackPush(frame, retval);
goto resume_frame;
}