Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
bpo-43683: Handle generator entry in bytecode#25138
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
bpo-43683: Handle generator entry in bytecode#25138
Uh oh!
There was an error while loading.Please reload this page.
Conversation
4dff1d0 to46c71f5Compare
willingc 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.
LGTM
Misc/NEWS.d/next/Core and Builtins/2021-04-01-12-30-30.bpo-43683.AjxOx2.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Core and Builtins/2021-04-01-12-30-30.bpo-43683.AjxOx2.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…o bytecode.Document new bytecode and make it fail gracefully if mis-compiled.Add NEWS itemBump magic number.
46c71f5 to1a29ec3CompareUh oh!
There was an error while loading.Please reload this page.
| entryblock=b; | ||
| } | ||
| if (insert_generator_prefix(c,entryblock)) { |
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.
If we're compiling a generator (or coroutine etc.) the new function assumes (without asserting) that entryblock is not NULL. But evidently it could be, since below on line 6690 there's a check whether it could be. I don't know how it could be NULL - that would mean there's no code in the function at all, but it seems there's code above that always adds at least one instruction (RETURN_VALUE on line 6668). So maybe the check for entryblock == NULL below can be replaced by an assert? (I'd place that assert right underneath the for-loop above on lines 6683-6686.
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.
entryblock cannot be NULL. I'll add the assert.
markshannon commentedApr 6, 2021
Fixes are in#25224 |
Uh oh!
There was an error while loading.Please reload this page.
Adds GEN_START bytecode to handle checking for None when starting a generator or coroutine.
This means that:
send()doesn't need to check the state of the generator.https://bugs.python.org/issue43683