gh-100758: Refactor initialisation of frame headers into a single function (_PyFrame_Initialize) (GH-100759)

This commit is contained in:
Irit Katriel 2023-01-06 14:55:56 +00:00 committed by GitHub
parent 78068126a1
commit 15c44789bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 53 deletions

View file

@ -1974,11 +1974,8 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, PyFunctionObject *func,
if (frame == NULL) {
goto fail;
}
_PyFrame_InitializeSpecials(frame, func, locals, code);
_PyFrame_Initialize(frame, func, locals, code, 0);
PyObject **localsarray = &frame->localsplus[0];
for (int i = 0; i < code->co_nlocalsplus; i++) {
localsarray[i] = NULL;
}
if (initialize_locals(tstate, func, localsarray, args, argcount, kwnames)) {
assert(frame->owner != FRAME_OWNED_BY_GENERATOR);
_PyEvalFrameClearAndPop(tstate, frame);