Skip to content

gh-131798: Split FOR_ITER_GEN into smaller uops#148372

Open
Sacul0457 wants to merge 3 commits intopython:mainfrom
Sacul0457:Optimize-_FOR_ITER_GEN_FRAME
Open

gh-131798: Split FOR_ITER_GEN into smaller uops#148372
Sacul0457 wants to merge 3 commits intopython:mainfrom
Sacul0457:Optimize-_FOR_ITER_GEN_FRAME

Conversation

@Sacul0457
Copy link
Copy Markdown
Contributor

@Sacul0457 Sacul0457 commented Apr 11, 2026

I'm not sure how the optimizer knows the symbolic type on the first guard but it seems to work?

@Fidget-Spinner
Copy link
Copy Markdown
Member

I'm not sure how the optimizer knows the symbolic type on the first guard but it seems to work?

Uh oh. you just caught a bug in the JIT optimizer. Would you like to fix it?

The problem is that this line is wrong https://github.com/python/cpython/blob/main/Python/optimizer_symbols.c#L807 it should not be returning PyGen_Type, but rather NULL. Instead, _Py_uop_sym_get_probable_type should be the one returning PyGen_Type.

If you want to fix it, just move the lines around amend this small test to !, and copy the same line and change it to probable type https://github.com/python/cpython/blob/main/Python/optimizer_symbols.c#L2214

@Sacul0457
Copy link
Copy Markdown
Contributor Author

Sure!
Should I fix it in this PR or create a new issue and open a separate PR?

@Fidget-Spinner
Copy link
Copy Markdown
Member

Please open an issue and fix it in that PR. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants