From ad90e7683112c6ab5c5662d0a37226da6a5dca87 Mon Sep 17 00:00:00 2001 From: Ken Jin Date: Wed, 14 Jan 2026 18:35:45 +0000 Subject: [PATCH 1/2] ENTER_EXECUTOR can be inserted after BINARY_OP_INPLACE_ADD_UNICODE --- Python/bytecodes.c | 5 +++++ Python/executor_cases.c.h | 10 ++++++++++ Python/generated_cases.c.h | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 66f322c2ef7757..d16a35bb5349fc 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -783,6 +783,11 @@ dummy_func( int next_oparg; #if TIER_ONE + #if _Py_TIER2 + // In JIT builds, we might have inserted an executor after this instruction, + // which breaks this super instruction. + DEOPT_IF(next_instr->op.code != STORE_FAST); + #endif assert(next_instr->op.code == STORE_FAST); next_oparg = next_instr->op.arg; #else diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 42cca042022fc1..6d98e5e3f4c93f 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -5065,6 +5065,16 @@ assert(PyUnicode_CheckExact(PyStackRef_AsPyObjectBorrow(right))); int next_oparg; #if TIER_ONE + #if _Py_TIER2 + + if (next_instr->op.code != STORE_FAST) { + UOP_STAT_INC(uopcode, miss); + _tos_cache1 = right; + _tos_cache0 = left; + SET_CURRENT_CACHED_VALUES(2); + JUMP_TO_JUMP_TARGET(); + } + #endif assert(next_instr->op.code == STORE_FAST); next_oparg = next_instr->op.arg; #else diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index b9b493130d732f..43f4db88ec3107 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -413,6 +413,13 @@ assert(PyUnicode_CheckExact(PyStackRef_AsPyObjectBorrow(right))); int next_oparg; #if TIER_ONE + #if _Py_TIER2 + if (next_instr->op.code != STORE_FAST) { + UPDATE_MISS_STATS(BINARY_OP); + assert(_PyOpcode_Deopt[opcode] == (BINARY_OP)); + JUMP_TO_PREDICTED(BINARY_OP); + } + #endif assert(next_instr->op.code == STORE_FAST); next_oparg = next_instr->op.arg; #else From 7f38ff5017af71469f28e0cd0b06121154e11227 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:18:26 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2026-01-15-22-18-19.gh-issue-143820.eRhozc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-01-15-22-18-19.gh-issue-143820.eRhozc.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-01-15-22-18-19.gh-issue-143820.eRhozc.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-15-22-18-19.gh-issue-143820.eRhozc.rst new file mode 100644 index 00000000000000..e8755c73233abf --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-15-22-18-19.gh-issue-143820.eRhozc.rst @@ -0,0 +1 @@ +Fix a bug in JIT builds where executors can be inserted after certain super instructions.