summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2023-08-21 05:50:09 (GMT)
committerGitHub <noreply@github.com>2023-08-21 05:50:09 (GMT)
commit4fdf3fda0f970805b2404e71f466f430ab8cd9fd (patch)
treeb1d90c397b6b28771ef938a83ee1c1d55b216b5e /Objects/codeobject.c
parent04f7875c4489bbe817e76f9f33773c8c21ba4ec2 (diff)
downloadcpython-4fdf3fda0f970805b2404e71f466f430ab8cd9fd.zip
cpython-4fdf3fda0f970805b2404e71f466f430ab8cd9fd.tar.gz
cpython-4fdf3fda0f970805b2404e71f466f430ab8cd9fd.tar.bz2
gh-107265: Fix code_richcompare for ENTER_EXECUTOR case (gh-108165)
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 4d6efe9..c34905c 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -1781,8 +1781,25 @@ 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;
+ co_instr.op.arg = exec->vm_data.oparg;
+ }
+ 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;
+ cp_instr.op.arg = exec->vm_data.oparg;
+ }
+ 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;