summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_frame.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-06-18 10:00:29 (GMT)
committerGitHub <noreply@github.com>2021-06-18 10:00:29 (GMT)
commit0982ded179f280176868c1c4eccf77bf70687816 (patch)
tree961c9e5ce60cffb79260fbc5a5b8ff321f68cc1b /Include/internal/pycore_frame.h
parent7f01f77f8fabcfd7ddb5d99f12d6fc99af9af384 (diff)
downloadcpython-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.h10
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