Visitar URL original
Bytecode parity - folding, class prologue, except cleanup · RustPython/RustPython@e21cabc · GitHub
Skip to content

Commit e21cabc

Browse files
committed
Bytecode parity - folding, class prologue, except cleanup
Constant folding: - Add string/bytes multiply and bytes concat folding in IR - Add constant subscript folding (str, bytes, tuple indexing) - Delegate list/set constant folding to IR passes - Stream big non-const list/set via BUILD+LIST_APPEND Class/generic compilation: - Reorder class body prologue: __type_params__ before __classdict__ - Build class function before .generic_base in generic classes - Register .type_params/.generic_base symbols in proper scopes - Use load_name/store_name helpers for synthetic variables Return block handling: - Only duplicate return-None epilogues, not arbitrary returns - Add inline_pop_except_return_blocks pass - Add duplicate_named_except_cleanup_returns pass Other fixes: - Fix eliminate_dead_stores to only collapse adjacent duplicates - Skip STORE_FAST_LOAD_FAST superinstruction in generators after FOR_ITER - Thread jumps through NOP-only blocks - Transfer NOP line info to following unconditional jumps - Extract scope_needs_conditional_annotations_cell helper - Register __conditional_annotations__ for module future annotations
1 parent c79baa3 commit e21cabc

8 files changed

Lines changed: 598 additions & 163 deletions

File tree

‎Lib/test/test_compile.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2576,15 +2576,13 @@ def test_if_else(self):
25762576
def test_binop(self):
25772577
self.check_stack_size("x + " * self.N + "x")
25782578

2579-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 101 not less than or equal to 6
25802579
def test_list(self):
25812580
self.check_stack_size("[" + "x, " * self.N + "x]")
25822581

25832582
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 101 not less than or equal to 6
25842583
def test_tuple(self):
25852584
self.check_stack_size("(" + "x, " * self.N + "x)")
25862585

2587-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 101 not less than or equal to 6
25882586
def test_set(self):
25892587
self.check_stack_size("{" + "x, " * self.N + "x}")
25902588

‎Lib/test/test_peepholer.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,6 @@ def test_constant_folding_binop(self):
441441
self.check_lnotab(code)
442442

443443

444-
@unittest.expectedFailure # TODO: RUSTPYTHON
445444
def test_constant_folding_remove_nop_location(self):
446445
sources = [
447446
"""

‎Lib/test/test_tstring.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def test_conversions(self):
111111
with self.assertRaises(SyntaxError):
112112
eval("t'{num!z}'")
113113

114-
@unittest.expectedFailure # TODO: RUSTPYTHON; ? ++++++
115114
def test_debug_specifier(self):
116115
# Test debug specifier
117116
value = 42

‎Lib/test/test_typing.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4697,7 +4697,6 @@ class D(Generic[T]): pass
46974697
with self.assertRaises(TypeError):
46984698
D[()]
46994699

4700-
@unittest.expectedFailure # TODO: RUSTPYTHON
47014700
def test_generic_init_subclass_not_called_error(self):
47024701
notes = ["Note: this exception may have been caused by "
47034702
r"'GenericTests.test_generic_init_subclass_not_called_error.<locals>.Base.__init_subclass__' "

0 commit comments

Comments
 (0)