Skip to content

Commit 55119d3

Browse files
committed
add test case
1 parent b2da71a commit 55119d3

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
@@ -2094,6 +2094,19 @@ def testfunc(n):
20942094
self.assertNotIn("_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW", uops)
20952095
self.assertNotIn("_SWAP_CALL_TWO_LOAD_CONST_INLINE_BORROW", uops)
20962096

2097+
def test_call_isinstance_guards_pop_top(self):
2098+
def testfunc(n):
2099+
x = 0
2100+
for _ in range(n):
2101+
x += isinstance(42, int)
2102+
return x
2103+
2104+
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
2105+
self.assertEqual(res, TIER2_THRESHOLD)
2106+
self.assertIsNotNone(ex)
2107+
uops = get_opnames(ex)
2108+
self.assertIn("_POP_TOP_NOP", uops)
2109+
20972110
def test_call_list_append(self):
20982111
def testfunc(n):
20992112
a = []

0 commit comments

Comments
 (0)