Skip to content

Commit 1bc3b12

Browse files
committed
Fix CI: remove expectedFailure for passing peepholer tests, rustfmt
- test_while_one: now passes with constant condition elimination - test_elim_jump_to_uncond_jump: now passes with JUMP→RETURN inlining - Apply rustfmt to ir.rs, frame.rs, compile.rs
1 parent 8741a7b commit 1bc3b12

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

Lib/test/test_peepholer.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ def f():
132132
self.assertInBytecode(f, 'LOAD_CONST', None)
133133
self.check_lnotab(f)
134134

135-
@unittest.expectedFailure # TODO: RUSTPYTHON; RETURN_VALUE
136135
def test_while_one(self):
137136
# Skip over: LOAD_CONST trueconst POP_JUMP_IF_FALSE xx
138137
def f():
@@ -545,7 +544,6 @@ def f(cond, true_value, false_value):
545544
self.assertEqual(len(returns), 2)
546545
self.check_lnotab(f)
547546

548-
@unittest.expectedFailure # TODO: RUSTPYTHON; absolute jump encoding
549547
def test_elim_jump_to_uncond_jump(self):
550548
# POP_JUMP_IF_FALSE to JUMP_FORWARD --> POP_JUMP_IF_FALSE to non-jump
551549
def f():

crates/codegen/src/compile.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7278,7 +7278,11 @@ impl Compiler {
72787278
(n_big_chunks, remainder)
72797279
} else {
72807280
// remainder is 0 or >15: all chunks are MAP_ADD chunks
7281-
let total_map_add = if remainder == 0 { n_big_chunks } else { n_big_chunks + 1 };
7281+
let total_map_add = if remainder == 0 {
7282+
n_big_chunks
7283+
} else {
7284+
n_big_chunks + 1
7285+
};
72827286
(total_map_add, 0usize)
72837287
};
72847288

crates/codegen/src/ir.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,10 @@ impl CodeInfo {
458458
let cache_count = info.cache_entries as usize;
459459
let (extras, lo_arg) = info.arg.split();
460460
let loc_pair = (info.location, info.end_location);
461-
locations
462-
.extend(core::iter::repeat_n(loc_pair, info.arg.instr_size() + cache_count));
461+
locations.extend(core::iter::repeat_n(
462+
loc_pair,
463+
info.arg.instr_size() + cache_count,
464+
));
463465
// Collect linetable locations with lineno_override support
464466
let lt_loc = LineTableLocation {
465467
line: info

crates/vm/src/frame.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9450,9 +9450,9 @@ impl ExecutingFrame<'_> {
94509450
// Returns the exception object; RERAISE will re-raise it
94519451
if arg.fast_isinstance(vm.ctx.exceptions.stop_iteration) {
94529452
let flags = &self.code.flags;
9453-
let msg = if flags.contains(
9454-
bytecode::CodeFlags::COROUTINE | bytecode::CodeFlags::GENERATOR,
9455-
) {
9453+
let msg = if flags
9454+
.contains(bytecode::CodeFlags::COROUTINE | bytecode::CodeFlags::GENERATOR)
9455+
{
94569456
"async generator raised StopIteration"
94579457
} else if flags.contains(bytecode::CodeFlags::COROUTINE) {
94589458
"coroutine raised StopIteration"

0 commit comments

Comments
 (0)