summaryrefslogtreecommitdiff
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-06-20 12:59:25 +0100
committerGitHub <noreply@github.com>2022-06-20 12:59:25 +0100
commit45e62a2bc1c0000e2e9b613fff6bebf2c26fcb93 (patch)
tree2fb6748705e118b6a3cd9264f6b946bcfa06e5e5 /Objects/codeobject.c
parent774ef28814d0d9d57ec813cb31b0a7af6c476127 (diff)
downloadcpython-git-45e62a2bc1c0000e2e9b613fff6bebf2c26fcb93.tar.gz
GH-93897: Store frame size in code object and de-opt if insufficient space on thread frame stack. (GH-93908)
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 8ac4e9914f..556d3a31c7 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -4,6 +4,7 @@
#include "opcode.h"
#include "structmember.h" // PyMemberDef
#include "pycore_code.h" // _PyCodeConstructor
+#include "pycore_frame.h" // FRAME_SPECIALS_SIZE
#include "pycore_interp.h" // PyInterpreterState.co_extra_freefuncs
#include "pycore_opcode.h" // _PyOpcode_Deopt
#include "pycore_pystate.h" // _PyInterpreterState_GET()
@@ -327,6 +328,7 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
/* derived values */
co->co_nlocalsplus = nlocalsplus;
co->co_nlocals = nlocals;
+ co->co_framesize = nlocalsplus + con->stacksize + FRAME_SPECIALS_SIZE;
co->co_nplaincellvars = nplaincellvars;
co->co_ncellvars = ncellvars;
co->co_nfreevars = nfreevars;