Uh oh!
There was an error while loading. Please reload this page.
GH-100762: Don't call gen.throw() in gen.close(), unless necessary. - #101013
Conversation
…xpensive gen.throw() in gen.close() where possible.
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.
gvanrossum
left a comment
There was a problem hiding this comment.
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.
brandtbucher
commented
Jan 24, 2023
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 |
gvanrossum
commented
Jan 24, 2023
Great, it'll just be different. :-) |
miss-islington
commented
Jan 24, 2023
Thanks @markshannon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
miss-islington
commented
Jan 24, 2023
Sorry, @markshannon, I could not cleanly backport this to |
brandtbucher
commented
Jan 24, 2023
I don’t think this should be backported as-is, right? (See my comment above.) |
@brandtbucher agreed. |
Change
opargofYIELD_VALUEto hold the exception handler depth.We can then test that in
gen.close()to avoid callinggen.throw()unless necessary.