bpo-44032: Move pointer to code object from frame-object to frame specials array. (GH-26771)

This commit is contained in:
Mark Shannon 2021-06-18 11:00:29 +01:00 committed by GitHub
parent 7f01f77f8f
commit 0982ded179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 41 deletions

View file

@ -8,7 +8,8 @@ enum {
FRAME_SPECIALS_GLOBALS_OFFSET = 0,
FRAME_SPECIALS_BUILTINS_OFFSET = 1,
FRAME_SPECIALS_LOCALS_OFFSET = 2,
FRAME_SPECIALS_SIZE = 3
FRAME_SPECIALS_CODE_OFFSET = 3,
FRAME_SPECIALS_SIZE = 4
};
static inline PyObject **
@ -30,6 +31,13 @@ _PyFrame_GetBuiltins(PyFrameObject *f)
return _PyFrame_Specials(f)[FRAME_SPECIALS_BUILTINS_OFFSET];
}
/* Returns a *borrowed* reference. */
static inline PyCodeObject *
_PyFrame_GetCode(PyFrameObject *f)
{
return (PyCodeObject *)_PyFrame_Specials(f)[FRAME_SPECIALS_CODE_OFFSET];
}
int _PyFrame_TakeLocals(PyFrameObject *f);
#ifdef __cplusplus