Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
Closed
Description
I think we should comparef->stackpointer
to the result of the_PyFrame_Stackbase(f)
in the_PyFrame_StackPeek
and in the_PyFrame_StackPop
rather than repeat the offset calculation in both of them.
cpython/Include/internal/pycore_interpframe.h
Lines 46 to 60 inc492ac7
staticinline_PyStackRef*_PyFrame_Stackbase(_PyInterpreterFrame*f) { | |
return (f->localsplus+_PyFrame_GetCode(f)->co_nlocalsplus); | |
} | |
staticinline_PyStackRef_PyFrame_StackPeek(_PyInterpreterFrame*f) { | |
assert(f->stackpointer>f->localsplus+_PyFrame_GetCode(f)->co_nlocalsplus); | |
assert(!PyStackRef_IsNull(f->stackpointer[-1])); | |
returnf->stackpointer[-1]; | |
} | |
staticinline_PyStackRef_PyFrame_StackPop(_PyInterpreterFrame*f) { | |
assert(f->stackpointer>f->localsplus+_PyFrame_GetCode(f)->co_nlocalsplus); | |
f->stackpointer--; | |
return*f->stackpointer; | |
} |