Skip to content

Commit

Permalink
Add test for FOR_ITER_RANGE
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Jul 8, 2023
1 parent df61257 commit e6c6603
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Lib/test/test_capi/test_misc.py
Expand Up @@ -2517,6 +2517,21 @@ def testfunc(x):
uops = {opname for opname, _ in ex}
self.assertIn("UNPACK_SEQUENCE", uops)

def test_for_iter(self):
def testfunc(x):
for i in range(x):
i += 1

opt = _testinternalcapi.get_uop_optimizer()

with temporary_optimizer(opt):
testfunc(10)

ex = get_first_executor(testfunc.__code__)
self.assertIsNotNone(ex)
uops = {opname for opname, _ in ex}
self.assertIn("FOR_ITER_RANGE", uops)


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

0 comments on commit e6c6603

Please sign in to comment.