GH-99729: Unlink frames before clearing them (GH-100030)

This commit is contained in:
Brandt Bucher 2022-12-06 06:01:38 -08:00 committed by GitHub
parent 85d5a7e8ef
commit b72014c783
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 11 deletions

View file

@ -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;
}