Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for FOR_ITER_RANGE
  • Loading branch information
gvanrossum committed Jul 8, 2023
commit e6c6603302e806989a8d738c498903794df2550f
15 changes: 15 additions & 0 deletions Lib/test/test_capi/test_misc.py
Original file line number Diff line number Diff line change
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()