Skip to content

Commit f4674b6

Browse files
committed
Bytecode parity - slice augassign, async comp inline
- Augmented assignment with two-part slices uses BINARY_SLICE/STORE_SLICE - Inline async comprehensions (remove await/async guards) - Inlined comprehension cleanup jump uses JumpNoInterrupt - Class firstlineno uses first decorator line when decorated - Recurse into nested functions for static attribute collection - Fold unary positive complex constants (+0.0j) - Add deoptimize_borrow_for_folded_nonliteral_exprs pass - Add inline_single_predecessor_artificial_expr_exit_blocks pass - Skip shared artificial expr-stmt exit blocks in small-block inlining - Mark folded boolop tail as folded_from_nonliteral_expr
1 parent 47068d7 commit f4674b6

10 files changed

Lines changed: 838 additions & 139 deletions

File tree

Lib/test/test_code.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,6 @@ def foo():
508508
with self.assertRaisesRegex(SystemError, msg):
509509
foo()
510510

511-
# TODO: RUSTPYTHON
512-
@unittest.expectedFailure
513511
# @requires_debug_ranges()
514512
def test_co_positions_artificial_instructions(self):
515513
import dis

Lib/test/test_compile.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,6 @@ class C:
999999
dis.dis(code)
10001000
self.assertNotIn('NOP', output.getvalue())
10011001

1002-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: unable to find constant -0.0 in (0.0,)
10031002
def test_dont_merge_constants(self):
10041003
# Issue #25843: compile() must not merge constants which are equal
10051004
# but have a different type.
@@ -1193,7 +1192,6 @@ def call():
11931192
line1 = call.__code__.co_firstlineno + 1
11941193
assert line1 not in [line for (_, _, line) in call.__code__.co_lines()]
11951194

1196-
@unittest.expectedFailure # TODO: RUSTPYTHON
11971195
def test_lineno_after_implicit_return(self):
11981196
TRUE = True
11991197
# Don't use constant True or False, as compiler will remove test
@@ -2495,7 +2493,6 @@ def f(self):
24952493
self.assertIsInstance(C.__static_attributes__, tuple)
24962494
self.assertEqual(sorted(C.__static_attributes__), ['a', 'b'])
24972495

2498-
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: type object 'C' has no attribute '__static_attributes__'
24992496
def test_nested_function(self):
25002497
class C:
25012498
def f(self):
@@ -2579,7 +2576,6 @@ def test_binop(self):
25792576
def test_list(self):
25802577
self.check_stack_size("[" + "x, " * self.N + "x]")
25812578

2582-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 101 not less than or equal to 6
25832579
def test_tuple(self):
25842580
self.check_stack_size("(" + "x, " * self.N + "x)")
25852581

Lib/test/test_inspect/test_inspect.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,6 @@ def test_nested_class_definition(self):
11611161
self.assertSourceEqual(mod2.cls183, 183, 188)
11621162
self.assertSourceEqual(mod2.cls183.cls185, 185, 188)
11631163

1164-
@unittest.expectedFailure # TODO: RUSTPYTHON; pass
11651164
def test_class_decorator(self):
11661165
self.assertSourceEqual(mod2.cls196, 194, 201)
11671166
self.assertSourceEqual(mod2.cls196.cls200, 198, 201)

Lib/test/test_peepholer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def crater():
199199
],)
200200
self.check_lnotab(crater)
201201

202-
@unittest.expectedFailure # TODO: RUSTPYTHON
203202
def test_constant_folding_lists_of_constants(self):
204203
for line, elem in (
205204
# in/not in constants with BUILD_LIST should be folded to a tuple:
@@ -214,7 +213,6 @@ def test_constant_folding_lists_of_constants(self):
214213
self.assertNotInBytecode(code, 'BUILD_LIST')
215214
self.check_lnotab(code)
216215

217-
@unittest.expectedFailure # TODO: RUSTPYTHON
218216
def test_constant_folding_sets_of_constants(self):
219217
for line, elem in (
220218
# in/not in constants with BUILD_SET should be folded to a frozenset:
@@ -634,7 +632,6 @@ def g()->1+1:
634632
self.assertNotInBytecode(f, 'BINARY_OP')
635633
self.check_lnotab(f)
636634

637-
@unittest.expectedFailure # TODO: RUSTPYTHON; no BUILD_LIST to BUILD_TUPLE optimization
638635
def test_in_literal_list(self):
639636
def containtest():
640637
return x in [a, b]

0 commit comments

Comments
 (0)