Skip to content

Commit b3f1187

Browse files
committed
Bytecode parity - iter folding, break/continue line, cold inlining
- Fold a constant list iterable into a constant tuple in for-loop iterable position, matching the CPython optimizer, and strip a redundant LIST_TO_TUPLE immediately before GET_ITER in the IR peephole pass. - Emit a Nop at the break/continue source range before unwinding so line events land on the break/continue statement instead of the following instruction. - Drop `propagate_disable_load_fast_borrow`; the forward propagation was over-zealous and the per-block inheritance in `new_block` plus the bare-except marker are enough. - Relax `inline_small_or_no_lineno_blocks` so small exit blocks at the tail of a cold block are always inlined, not just return epilogues. - Add codegen tests covering the LIST_TO_TUPLE/GET_ITER peephole and the late-CFG trace helper for a for-loop list-literal iterable.
1 parent 7a6db47 commit b3f1187

14 files changed

Lines changed: 1644 additions & 494 deletions

Lib/test/test_compile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,6 @@ def unused_block_while_else():
10841084
self.assertEqual('RETURN_VALUE', opcodes[-1].opname)
10851085
self.assertEqual(None, opcodes[-1].argval)
10861086

1087-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 3 != 8
10881087
def test_false_while_loop(self):
10891088
def break_in_while():
10901089
while False:

Lib/test/test_grammar.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ def test_var_annot_syntax_errors(self):
304304
" nonlocal x\n"
305305
" x: int\n")
306306

307-
@unittest.expectedFailure # TODO: RUSTPYTHON
308307
def test_var_annot_basic_semantics(self):
309308
# execution order
310309
with self.assertRaises(ZeroDivisionError):

Lib/test/test_sys_settrace.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,8 +1957,6 @@ def test_jump_out_of_finally_block(output):
19571957
finally:
19581958
output.append(5)
19591959

1960-
# TODO: RUSTPYTHON
1961-
@unittest.expectedFailure
19621960
@jump_test(1, 5, [], (ValueError, "into an 'except'"))
19631961
def test_no_jump_into_bare_except_block(output):
19641962
output.append(1)
@@ -1967,8 +1965,6 @@ def test_no_jump_into_bare_except_block(output):
19671965
except:
19681966
output.append(5)
19691967

1970-
# TODO: RUSTPYTHON
1971-
@unittest.expectedFailure
19721968
@jump_test(1, 5, [], (ValueError, "into an 'except'"))
19731969
def test_no_jump_into_qualified_except_block(output):
19741970
output.append(1)

0 commit comments

Comments
 (0)