Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
GH-100762: Don't callgen.throw() ingen.close(), unless necessary.#101013
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…xpensive gen.throw() in gen.close() where possible.
markshannon commentedJan 13, 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.
Using the benchmarks in#101011 (comment), but using |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
I guess this will not be easy to backport, as we won't want to change the meaning of oparg in 3.11? Then again it appears to be unused except for the assert. Maybe it should just be a bit indicating whether it's safe to optimize out the throw?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
I think a similar change in 3.11 would actually be simpler: just check if an exception table exists. If not, don't throw. The only reason we need the |
Great, it'll just bedifferent. :-) |
Thanks@markshannon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
Sorry,@markshannon, I could not cleanly backport this to |
I don’t think this should be backported as-is, right? (See my comment above.) |
markshannon commentedJan 25, 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.
@brandtbucher agreed. |
Uh oh!
There was an error while loading.Please reload this page.
Change
opargofYIELD_VALUEto hold the exception handler depth.We can then test that in
gen.close()to avoid callinggen.throw()unless necessary.