8000 Add test · python/cpython@10b98f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 10b98f1

Browse files
committed
Add test
1 parent 8f5e623 commit 10b98f1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,27 @@ def testfunc(n):
539539
# too much already.
540540
self.assertEqual(count, 1)
541541

542+
def test_side_exits(self):
543+
def testfunc():
544+
for _ in range(100):
545+
for i in range(100):
546+
if i >= 70:
547+
i = 0
548+
549+
opt = _testinternalcapi.get_uop_optimizer()
550+
with temporary_optimizer(opt):
551+
testfunc()
552+
553+
ex = get_first_executor(testfunc)
554+
self.assertIsNotNone(ex)
555+
uops = {opname for opname, _, _ in ex}
556+
self.assertIn("_GUARD_IS_FALSE_POP", uops)
557+
subs = [sub for sub in ex.sub_executors() if sub is not None]
558+
self.assertGreater(len(subs), 0)
559+
sub = subs[0]
560+
sub_uops = {opname for opname, _, _ in sub}
561+
self.assertIn("_GUARD_IS_TRUE_POP", sub_uops)
562+
542563

543564
if __name__ == "__main__":
544565
unittest.main()

0 commit comments

Comments
 (0)
0