mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-109052: Use the base opcode when comparing code objects (gh-109107)
This commit is contained in:
parent
a56c928756
commit
057bc72490
3 changed files with 24 additions and 6 deletions
|
@ -1798,28 +1798,26 @@ 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];
|
||||
uint8_t co_code = co_instr.op.code;
|
||||
uint8_t co_code = _Py_GetBaseOpcode(co, i);
|
||||
uint8_t co_arg = co_instr.op.arg;
|
||||
uint8_t cp_code = cp_instr.op.code;
|
||||
uint8_t cp_code = _Py_GetBaseOpcode(cp, i);
|
||||
uint8_t cp_arg = cp_instr.op.arg;
|
||||
|
||||
if (co_code == ENTER_EXECUTOR) {
|
||||
const int exec_index = co_arg;
|
||||
_PyExecutorObject *exec = co->co_executors->executors[exec_index];
|
||||
co_code = exec->vm_data.opcode;
|
||||
co_code = _PyOpcode_Deopt[exec->vm_data.opcode];
|
||||
co_arg = exec->vm_data.oparg;
|
||||
}
|
||||
assert(co_code != ENTER_EXECUTOR);
|
||||
co_code = _PyOpcode_Deopt[co_code];
|
||||
|
||||
if (cp_code == ENTER_EXECUTOR) {
|
||||
const int exec_index = cp_arg;
|
||||
_PyExecutorObject *exec = cp->co_executors->executors[exec_index];
|
||||
cp_code = exec->vm_data.opcode;
|
||||
cp_code = _PyOpcode_Deopt[exec->vm_data.opcode];
|
||||
cp_arg = exec->vm_data.oparg;
|
||||
}
|
||||
assert(cp_code != ENTER_EXECUTOR);
|
||||
cp_code = _PyOpcode_Deopt[cp_code];
|
||||
|
||||
if (co_code != cp_code || co_arg != cp_arg) {
|
||||
goto unequal;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue