mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
gh-100720: refactor calculation of number of frame slots for a code object into the new function _PyFrame_NumSlotsForCodeObject (#100722)
This commit is contained in:
parent
5fb1c08e15
commit
c31e356a10
5 changed files with 15 additions and 4 deletions
|
|
@ -92,7 +92,16 @@ static inline void _PyFrame_StackPush(_PyInterpreterFrame *f, PyObject *value) {
|
|||
f->stacktop++;
|
||||
}
|
||||
|
||||
#define FRAME_SPECIALS_SIZE ((sizeof(_PyInterpreterFrame)-1)/sizeof(PyObject *))
|
||||
#define FRAME_SPECIALS_SIZE ((int)((sizeof(_PyInterpreterFrame)-1)/sizeof(PyObject *)))
|
||||
|
||||
static inline int
|
||||
_PyFrame_NumSlotsForCodeObject(PyCodeObject *code)
|
||||
{
|
||||
/* This function needs to remain in sync with the calculation of
|
||||
* co_framesize in Tools/build/deepfreeze.py */
|
||||
assert(code->co_framesize >= FRAME_SPECIALS_SIZE);
|
||||
return code->co_framesize - FRAME_SPECIALS_SIZE;
|
||||
}
|
||||
|
||||
void _PyFrame_Copy(_PyInterpreterFrame *src, _PyInterpreterFrame *dest);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue