diff options
author | Tian Gao <gaogaotiantian@hotmail.com> | 2023-09-09 01:24:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-09 01:24:49 (GMT) |
commit | 057bc7249073066ed8087b548ee06f0eabfa9e7c (patch) | |
tree | 97d123718225d24a6baf505d946bf027ee5b9ca4 /Objects | |
parent | a56c92875699c2ba92ed49e72f6abbf363a5c537 (diff) | |
download | cpython-057bc7249073066ed8087b548ee06f0eabfa9e7c.zip cpython-057bc7249073066ed8087b548ee06f0eabfa9e7c.tar.gz cpython-057bc7249073066ed8087b548ee06f0eabfa9e7c.tar.bz2 |
gh-109052: Use the base opcode when comparing code objects (gh-109107)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/codeobject.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c index d00bd04..20e5ded 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -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; |