Skip to content

Commit 492df4e

Browse files
committed
Initialize sub-stack slot on non-debug builds as well
1 parent 7509764 commit 492df4e

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

Include/internal/pycore_interpframe.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,10 @@ _PyFrame_Initialize(
146146
frame->owner = FRAME_OWNED_BY_THREAD;
147147
frame->visited = 0;
148148
#ifdef Py_DEBUG
149-
frame->localsplus[code->co_nlocalsplus] = PyStackRef_NULL;
150149
frame->lltrace = 0;
151150
#endif
152151

153-
for (int i = null_locals_from; i < code->co_nlocalsplus; i++) {
152+
for (int i = null_locals_from; i <= code->co_nlocalsplus; i++) {
154153
frame->localsplus[i] = PyStackRef_NULL;
155154
}
156155
}

Python/ceval.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,9 +990,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int
990990
* These are cached values from the frame and code object. */
991991
_Py_CODEUNIT *next_instr;
992992
_PyStackRef *stack_pointer;
993-
#ifdef Py_DEBUG
994993
entry_frame.localsplus[0] = PyStackRef_NULL;
995-
#endif
996994
#ifdef Py_STACKREF_DEBUG
997995
entry_frame.f_funcobj = PyStackRef_None;
998996
#elif defined(Py_DEBUG)

0 commit comments

Comments
 (0)