summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-06-14 10:09:30 (GMT)
committerGitHub <noreply@github.com>2022-06-14 10:09:30 (GMT)
commit3cd1a5d3ec487e23e3d976e7dd235329f04cfc73 (patch)
tree53e270197be3ceec9e38277ec30a0338631a6727 /Objects/codeobject.c
parent2bf74753c14e5360e04930b478703f4e2618f4a3 (diff)
downloadcpython-3cd1a5d3ec487e23e3d976e7dd235329f04cfc73.zip
cpython-3cd1a5d3ec487e23e3d976e7dd235329f04cfc73.tar.gz
cpython-3cd1a5d3ec487e23e3d976e7dd235329f04cfc73.tar.bz2
GH-93516: Store offset of first traceable instruction in code object (GH-93769)
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 2a2f132..8ac4e99 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -339,6 +339,12 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
co->co_warmup = QUICKENING_INITIAL_WARMUP_VALUE;
memcpy(_PyCode_CODE(co), PyBytes_AS_STRING(con->code),
PyBytes_GET_SIZE(con->code));
+ int entry_point = 0;
+ while (entry_point < Py_SIZE(co) &&
+ _Py_OPCODE(_PyCode_CODE(co)[entry_point]) != RESUME) {
+ entry_point++;
+ }
+ co->_co_firsttraceable = entry_point;
}
static int