8000 gh-106529: Support FOR_ITER specializations as uops by gvanrossum · Pull Request #106542 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-106529: Support FOR_ITER specializations as uops #106542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
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()
0