diff options
author | Mark Shannon <mark@hotpy.org> | 2021-06-18 10:00:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-18 10:00:29 (GMT) |
commit | 0982ded179f280176868c1c4eccf77bf70687816 (patch) | |
tree | 961c9e5ce60cffb79260fbc5a5b8ff321f68cc1b /Include/internal/pycore_frame.h | |
parent | 7f01f77f8fabcfd7ddb5d99f12d6fc99af9af384 (diff) | |
download | cpython-0982ded179f280176868c1c4eccf77bf70687816.zip cpython-0982ded179f280176868c1c4eccf77bf70687816.tar.gz cpython-0982ded179f280176868c1c4eccf77bf70687816.tar.bz2 |
bpo-44032: Move pointer to code object from frame-object to frame specials array. (GH-26771)
Diffstat (limited to 'Include/internal/pycore_frame.h')
-rw-r--r-- | Include/internal/pycore_frame.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Include/internal/pycore_frame.h b/Include/internal/pycore_frame.h index 44f58fb..e30e3c8 100644 --- a/Include/internal/pycore_frame.h +++ b/Include/internal/pycore_frame.h @@ -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 |