Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions 13 Lib/test/test_capi/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,19 @@ def testfunc(n):
uops = get_opnames(ex)
self.assertIn(self.guard_is_false, uops)

def test_branch_coincident_targets(self):
# test for gh-144681: https://github.com/python/cpython/issues/144681
def testfunc(n):
for _ in range(n):
r = [x for x in range(10) if [].append(x) or True]
return r

res = testfunc(TIER2_THRESHOLD)
ex = get_first_executor(testfunc)

self.assertEqual(res, list(range(10)))
self.assertIsNotNone(ex)

def test_for_iter_tier_two(self):
class MyIter:
def __init__(self, n):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a JIT assertion failure when a conditional branch jumps to the same target as the fallthrough path.
4 changes: 2 additions & 2 deletions 4 Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,8 @@ _PyJit_translate_single_bytecode_to_trace(
_Py_CODEUNIT *computed_next_instr = computed_next_instr_without_modifiers + (computed_next_instr_without_modifiers->op.code == NOT_TAKEN);
_Py_CODEUNIT *computed_jump_instr = computed_next_instr_without_modifiers + oparg;
assert(next_instr == computed_next_instr || next_instr == computed_jump_instr);
int jump_happened = computed_jump_instr == next_instr;
assert(jump_happened == (target_instr[1].cache & 1));
int jump_happened = target_instr[1].cache & 1;
assert(jump_happened ? (next_instr == computed_jump_instr) : (next_instr == computed_next_instr));
uint32_t uopcode = BRANCH_TO_GUARD[opcode - POP_JUMP_IF_FALSE][jump_happened];
ADD_TO_TRACE(uopcode, 0, 0, INSTR_IP(jump_happened ? computed_next_instr : computed_jump_instr, old_code));
break;
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.