-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
I think we should compare f->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 in c492ac7
static inline _PyStackRef *_PyFrame_Stackbase(_PyInterpreterFrame *f) { | |
return (f->localsplus + _PyFrame_GetCode(f)->co_nlocalsplus); | |
} | |
static inline _PyStackRef _PyFrame_StackPeek(_PyInterpreterFrame *f) { | |
assert(f->stackpointer > f->localsplus + _PyFrame_GetCode(f)->co_nlocalsplus); | |
assert(!PyStackRef_IsNull(f->stackpointer[-1])); | |
return f->stackpointer[-1]; | |
} | |
static inline _PyStackRef _PyFrame_StackPop(_PyInterpreterFrame *f) { | |
assert(f->stackpointer > f->localsplus + _PyFrame_GetCode(f)->co_nlocalsplus); | |
f->stackpointer--; | |
return *f->stackpointer; | |
} |
Linked PRs
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement