[3.14] gh-137030: Fix YIELD_VALUE bytecode assertion (#149184) (#149383)

gh-137030: Fix YIELD_VALUE bytecode assertion (#149184)


(cherry picked from commit 952784af47)

Co-authored-by: Mark Shannon <mark@hotpy.org>
This commit is contained in:
Victor Stinner 2026-05-04 23:41:19 +02:00 committed by GitHub
parent 96b81d527c
commit 690b2bb615
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 28 additions and 30 deletions

View file

@ -1975,13 +1975,12 @@
frame = tstate->current_frame = frame->previous;
gen_frame->previous = NULL;
assert(INLINE_CACHE_ENTRIES_SEND == INLINE_CACHE_ENTRIES_FOR_ITER);
#if TIER_ONE
assert(frame->instr_ptr->op.code == INSTRUMENTED_LINE ||
frame->instr_ptr->op.code == INSTRUMENTED_INSTRUCTION ||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == SEND ||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == FOR_ITER ||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == INTERPRETER_EXIT ||
_PyOpcode_Deopt[frame->instr_ptr->op.code] == ENTER_EXECUTOR);
#if TIER_ONE && defined(Py_DEBUG)
if (!PyStackRef_IsNone(frame->f_executable)) {
int i = frame->instr_ptr - _PyFrame_GetBytecode(frame);
int opcode = _Py_GetBaseCodeUnit(_PyFrame_GetCode(frame), i).op.code;
assert(opcode == SEND || opcode == FOR_ITER);
}
#endif
stack_pointer = _PyFrame_GetStackPointer(frame);
LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND);