Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 #111459
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
iritkatriel commented Oct 29, 2023 • edited by github-actions bot
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by github-actions bot
Uh oh!
There was an error while loading. Please reload this page.
markshannon commented Oct 30, 2023 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Doesn't this mean we lose the optimization for |
markshannon left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
bedevere-bot commented Nov 2, 2023
|
bedevere-bot commented Nov 2, 2023
|
bedevere-bot commented Nov 2, 2023
|
bedevere-bot commented Nov 2, 2023
|
gen_closeneeds to know whether aRESUMEfollows aYIELD_VALUEwhich is at except-depth 1, for an important optimization. Currently the compiler stores this information in the oparg ofYIELD_VALUE, which requiresgen_closeto peek into the bytecode (which is unsafe in the debugger). This PR puts this information in the oparg of theRESUME, and removes the oparg ofYIELD_VALUE. The result is simpler and safer code in gen_close.It also removes an anomaly in the bytecode definitions, where we needed to add a meaningless assertion to make the code generator understand that YIELD_VALUE has an oparg even though it doesn't use it.
📚 Documentation preview 📚: https://cpython-previews--111459.org.readthedocs.build/