diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-07-22 23:28:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-22 23:28:03 (GMT) |
commit | e4d3a96a113070fde433834a6c9fb79ebeebad4a (patch) | |
tree | 6033a5169cbf594c2d9c6b42c6d3d5b96ebba3c1 /Objects/frameobject.c | |
parent | 900bfc53cb133e8bc2b122362ec04256f623d5b0 (diff) | |
download | cpython-e4d3a96a113070fde433834a6c9fb79ebeebad4a.zip cpython-e4d3a96a113070fde433834a6c9fb79ebeebad4a.tar.gz cpython-e4d3a96a113070fde433834a6c9fb79ebeebad4a.tar.bz2 |
GH-94438: Handle extended arguments and conditional pops in mark_stacks (GH-95110)
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r-- | Objects/frameobject.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 9e5450a..26b38ba 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -319,11 +319,15 @@ mark_stacks(PyCodeObject *code_obj, int len) int64_t target_stack; int j = get_arg(code, i); if (opcode == POP_JUMP_FORWARD_IF_FALSE || - opcode == POP_JUMP_FORWARD_IF_TRUE) { + opcode == POP_JUMP_FORWARD_IF_TRUE || + opcode == JUMP_IF_FALSE_OR_POP || + opcode == JUMP_IF_TRUE_OR_POP) + { j += i + 1; } - else if (opcode == POP_JUMP_BACKWARD_IF_FALSE || - opcode == POP_JUMP_BACKWARD_IF_TRUE) { + else { + assert(opcode == POP_JUMP_BACKWARD_IF_FALSE || + opcode == POP_JUMP_BACKWARD_IF_TRUE); j = i + 1 - j; } assert(j < len); @@ -459,7 +463,8 @@ mark_stacks(PyCodeObject *code_obj, int len) } default: { - int delta = PyCompile_OpcodeStackEffect(opcode, _Py_OPARG(code[i])); + int delta = PyCompile_OpcodeStackEffect(opcode, get_arg(code, i)); + assert(delta != PY_INVALID_STACK_EFFECT); while (delta < 0) { next_stack = pop_value(next_stack); delta++; |