mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-126835: Move constant tuple folding from ast_opt to CFG (#130769)
This commit is contained in:
parent
54efe296bc
commit
75103d975c
9 changed files with 264 additions and 172 deletions
|
@ -1666,7 +1666,8 @@ class TestSpecializer(TestBase):
|
|||
def test_unpack_sequence(self):
|
||||
def unpack_sequence_two_tuple():
|
||||
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
|
||||
a, b = 1, 2
|
||||
t = 1, 2
|
||||
a, b = t
|
||||
self.assertEqual(a, 1)
|
||||
self.assertEqual(b, 2)
|
||||
|
||||
|
@ -1677,8 +1678,11 @@ class TestSpecializer(TestBase):
|
|||
|
||||
def unpack_sequence_tuple():
|
||||
for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD):
|
||||
a, = 1,
|
||||
a, b, c, d = 1, 2, 3, 4
|
||||
self.assertEqual(a, 1)
|
||||
self.assertEqual(b, 2)
|
||||
self.assertEqual(c, 3)
|
||||
self.assertEqual(d, 4)
|
||||
|
||||
unpack_sequence_tuple()
|
||||
self.assert_specialized(unpack_sequence_tuple, "UNPACK_SEQUENCE_TUPLE")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue