bpo-45786: Allocate space for frame in frame object. (GH-29729)

This commit is contained in:
Mark Shannon 2021-11-29 12:34:59 +00:00 committed by GitHub
parent 7431448b81
commit 60929576e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 76 additions and 181 deletions

View file

@ -5694,7 +5694,8 @@ make_coro_frame(PyThreadState *tstate,
}
assert(frame->frame_obj == NULL);
if (initialize_locals(tstate, func, frame->localsplus, args, argcount, kwnames)) {
_PyFrame_Clear(frame, 1);
_PyFrame_Clear(frame);
PyMem_Free(frame);
return NULL;
}
return frame;
@ -5750,7 +5751,7 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func,
localsarray[i] = NULL;
}
if (initialize_locals(tstate, func, localsarray, args, argcount, kwnames)) {
_PyFrame_Clear(frame, 0);
_PyFrame_Clear(frame);
return NULL;
}
return frame;
@ -5773,11 +5774,8 @@ static int
_PyEvalFrameClearAndPop(PyThreadState *tstate, InterpreterFrame * frame)
{
--tstate->recursion_remaining;
assert(frame->frame_obj == NULL || frame->frame_obj->f_own_locals_memory == 0);
if (_PyFrame_Clear(frame, 0)) {
++tstate->recursion_remaining;
return -1;
}
assert(frame->frame_obj == NULL || frame->frame_obj->f_owns_frame == 0);
_PyFrame_Clear(frame);
++tstate->recursion_remaining;
_PyThreadState_PopFrame(tstate, frame);
return 0;