[3.14] gh-140104: Revert "Set next_instr properly in the JIT during exceptions (GH-140233) (GH-140687)" (#140890)
Some checks failed
Tests / Change detection (push) Waiting to run
Tests / Docs (push) Blocked by required conditions
Tests / Check if the ABI has changed (push) Blocked by required conditions
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / Android (aarch64) (push) Blocked by required conditions
Tests / Android (x86_64) (push) Blocked by required conditions
Tests / iOS (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / Sanitizers (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
JIT / Interpreter (Debug) (push) Has been cancelled
Tail calling interpreter / aarch64-apple-darwin/clang (push) Has been cancelled
Tail calling interpreter / aarch64-unknown-linux-gnu/gcc (push) Has been cancelled
Tail calling interpreter / x86_64-pc-windows-msvc/msvc (push) Has been cancelled
Tail calling interpreter / x86_64-apple-darwin/clang (push) Has been cancelled
Tail calling interpreter / free-threading (push) Has been cancelled
Tail calling interpreter / x86_64-unknown-linux-gnu/gcc (push) Has been cancelled
Verify bundled wheels / verify (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled

Revert "[3.14] gh-140104: Set next_instr properly in the JIT during exceptions (GH-140233) (GH-140687)"

This reverts commit 2e21672803.
This commit is contained in:
Ken Jin 2025-11-02 02:41:01 +08:00 committed by GitHub
parent ab1fdf3d7c
commit 4d68b758fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 26 deletions

View file

@ -1972,27 +1972,6 @@ class TestUopsOptimization(unittest.TestCase):
assert ex is not None assert ex is not None
""")) """))
def test_next_instr_for_exception_handler_set(self):
# gh-140104: We just want the exception to be caught properly.
def f():
for i in range(TIER2_THRESHOLD + 3):
try:
undefined_variable(i)
except Exception:
pass
f()
def test_next_instr_for_exception_handler_set_lasts_instr(self):
# gh-140104: We just want the exception to be caught properly.
def f():
a_list = []
for _ in range(TIER2_THRESHOLD + 3):
try:
a_list[""] = 0
except Exception:
pass
def global_identity(x): def global_identity(x):
return x return x

View file

@ -1,2 +0,0 @@
Fix a bug with exception handling in the JIT. Patch by Ken Jin. Bug reported
by Daniel Diniz.

View file

@ -368,9 +368,7 @@ do { \
frame = tstate->current_frame; \ frame = tstate->current_frame; \
stack_pointer = _PyFrame_GetStackPointer(frame); \ stack_pointer = _PyFrame_GetStackPointer(frame); \
if (next_instr == NULL) { \ if (next_instr == NULL) { \
/* gh-140104: The exception handler expects frame->instr_ptr next_instr = frame->instr_ptr; \
to after this_instr, not this_instr! */ \
next_instr = frame->instr_ptr + 1; \
JUMP_TO_LABEL(error); \ JUMP_TO_LABEL(error); \
} \ } \
DISPATCH(); \ DISPATCH(); \