Skip to content

Commit f9822e9

Browse files
committed
fix review idea
Signed-off-by: Manjusaka <[email protected]>
1 parent 9c58f2c commit f9822e9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,19 @@ def testfunc(n):
19391939
self.assertNotIn("_GUARD_NOS_INT", uops)
19401940
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
19411941

1942+
def test_get_len_with_non_const_tuple(self):
1943+
def testfunc(n):
1944+
x = 0.0
1945+
for _ in range(n):
1946+
match (object(), object()):
1947+
case [_, _]:
1948+
x += 1.0
1949+
return x
1950+
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
1951+
self.assertEqual(int(res), TIER2_THRESHOLD)
1952+
uops = get_opnames(ex)
1953+
self.assertNotIn("_GUARD_NOS_INT", uops)
1954+
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
19421955

19431956
def test_get_len_with_non_tuple(self):
19441957
def testfunc(n):

0 commit comments

Comments
 (0)