Skip to content

Commit 47847be

Browse files
committed
test case
1 parent af1172a commit 47847be

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,22 @@ def testfunc(n):
18411841
uops = get_opnames(ex)
18421842
self.assertNotIn("_GUARD_IS_NOT_NONE_POP", uops)
18431843

1844+
def test_call_tuple_1_pop_top(self):
1845+
def testfunc(n):
1846+
x = 0
1847+
for _ in range(n):
1848+
t = tuple(())
1849+
x += len(t) == 0
1850+
return x
1851+
1852+
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
1853+
self.assertEqual(res, TIER2_THRESHOLD)
1854+
self.assertIsNotNone(ex)
1855+
uops = get_opnames(ex)
1856+
self.assertIn("_CALL_TUPLE_1", uops)
1857+
self.assertIn("_POP_TOP_NOP", uops)
1858+
1859+
18441860
def test_call_str_1(self):
18451861
def testfunc(n):
18461862
x = 0

0 commit comments

Comments
 (0)