Skip to content

Commit

Permalink
pythongh-107265: Fix code_richcompare to lookup actual opcode when EN…
Browse files Browse the repository at this point in the history
…TER_EXECUTOR
  • Loading branch information
corona10 committed Aug 20, 2023
1 parent 9bb576c commit e38c553
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1781,8 +1781,23 @@ code_richcompare(PyObject *self, PyObject *other, int op)
for (int i = 0; i < Py_SIZE(co); i++) {
_Py_CODEUNIT co_instr = _PyCode_CODE(co)[i];
_Py_CODEUNIT cp_instr = _PyCode_CODE(cp)[i];

if (co_instr.op.code == ENTER_EXECUTOR) {
const int exec_index = co_instr.op.arg;
_PyExecutorObject *exec = co->co_executors->executors[exec_index];
co_instr.op.code = exec->vm_data.opcode;
}
assert(co_instr.op.code != ENTER_EXECUTOR);
co_instr.op.code = _PyOpcode_Deopt[co_instr.op.code];

if (cp_instr.op.code == ENTER_EXECUTOR) {
const int exec_index = cp_instr.op.arg;
_PyExecutorObject *exec = cp->co_executors->executors[exec_index];
cp_instr.op.code = exec->vm_data.opcode;
}
assert(cp_instr.op.code != ENTER_EXECUTOR);
cp_instr.op.code = _PyOpcode_Deopt[cp_instr.op.code];

eq = co_instr.cache == cp_instr.cache;
if (!eq) {
goto unequal;
Expand Down

0 comments on commit e38c553

Please sign in to comment.