Skip to content

Commit ac6c21a

Browse files
check before not after
1 parent 08d6c79 commit ac6c21a

File tree

3 files changed

+358
-183
lines changed

3 files changed

+358
-183
lines changed

Python/optimizer_analysis.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,10 @@ incorrect_keys(PyObject *obj, uint32_t version)
187187
#define sym_new_truthiness _Py_uop_sym_new_truthiness
188188

189189
#define JUMP_TO_LABEL(label) goto label;
190-
#define CHECK_STACK_BOUNDS() \
190+
#define CHECK_STACK_BOUNDS(offset) \
191191
do { \
192-
if (!CURRENT_FRAME_IS_INIT_SHIM() && (STACK_LEVEL() < 0 || STACK_LEVEL() > STACK_SIZE())) { \
192+
int stack_level = (int)(stack_pointer + (offset) - ctx->frame->stack); \
193+
if (!CURRENT_FRAME_IS_INIT_SHIM() && (stack_level < 0 || stack_level > STACK_SIZE())) { \
193194
ctx->contradiction = true; \
194195
ctx->done = true; \
195196
break; \

0 commit comments

Comments
 (0)