Skip to content

Commit a49ce5b

Browse files
authored
Bytecode parity - exception (RustPython#7557)
* Fix exception handling: except* chaining, finally cleanup, RERAISE - Align except* bytecode chaining - Fix exception state model and finally handler cleanup - Fix RERAISE to only pop exception, preserve values below * Port IR optimization passes from flowgraph.c - BUILD_TUPLE n + UNPACK_SEQUENCE n elimination - Dead store elimination within basic blocks - apply_static_swaps for SWAP reduction * Add bytecode comparison and disassembly dump scripts - compare_bytecode.py: compare CPython vs RustPython bytecode output - dis_dump.py: extract disassembly in normalized JSON format
1 parent 7b5ac61 commit a49ce5b

8 files changed

Lines changed: 1724 additions & 205 deletions

File tree

Lib/test/test_peepholer.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def f():
144144
self.assertInBytecode(f, elem)
145145
self.check_lnotab(f)
146146

147-
@unittest.expectedFailure # TODO: RUSTPYTHON
148147
def test_pack_unpack(self):
149148
for line, elem in (
150149
('a, = a,', 'LOAD_CONST',),
@@ -158,7 +157,7 @@ def test_pack_unpack(self):
158157
self.assertNotInBytecode(code, 'UNPACK_SEQUENCE')
159158
self.check_lnotab(code)
160159

161-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 1 != 2
160+
@unittest.expectedFailure # TODO: RUSTPYTHON; LOAD_CONST count mismatch in long-tuple branch
162161
def test_constant_folding_tuples_of_constants(self):
163162
for line, elem in (
164163
('a = 1,2,3', (1, 2, 3)),
@@ -873,7 +872,6 @@ def f():
873872
self.assertInBytecode(f, 'LOAD_FAST_CHECK')
874873
self.assertNotInBytecode(f, 'LOAD_FAST')
875874

876-
@unittest.expectedFailure # TODO: RUSTPYTHON; RETURN_VALUE
877875
def test_load_fast_unknown_because_del(self):
878876
def f():
879877
x = 1
@@ -928,7 +926,6 @@ def f():
928926
self.assertInBytecode(f, 'LOAD_FAST_BORROW')
929927
self.assertNotInBytecode(f, 'LOAD_FAST_CHECK')
930928

931-
@unittest.expectedFailure # TODO: RUSTPYTHON; L5 to L6 -> L6 [1] lasti
932929
def test_load_fast_unknown_after_error(self):
933930
def f():
934931
try:
@@ -940,7 +937,6 @@ def f():
940937
# Assert that it doesn't occur in the LOAD_FAST_CHECK branch.
941938
self.assertInBytecode(f, 'LOAD_FAST_CHECK')
942939

943-
@unittest.expectedFailure # TODO: RUSTPYTHON; L5 to L6 -> L6 [1] lasti
944940
def test_load_fast_unknown_after_error_2(self):
945941
def f():
946942
try:

0 commit comments

Comments
 (0)