Skip to content

Commit 6c04f67

Browse files
committed
add test case
1 parent 3d0f5d3 commit 6c04f67

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

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

0 commit comments

Comments
 (0)