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
GH-100762: Don't call gen.throw() in gen.close(), unless necessary.
#101013
base: main
Are you sure you want to change the base?
Conversation
…xpensive gen.throw() in gen.close() where possible.
|
Using the benchmarks in #101011 (comment), but using |
|
|
||
| # Python 3.12a1 3517 (Change YIELD_VALUE oparg to exception block depth) |
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'm guessing you have a 3516 PR open somewhere?
| .. versionchanged:: 3.11 | ||
| oparg set to be the stack depth, for efficient handling on frames. | ||
| .. versionchanged:: 3.12 | ||
| oparg set to be the exception block depth, for efficient closing of generators. |
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.
Shouldn't the 3.11 note be retained (assuming it's truthful)?
Change
opargofYIELD_VALUEto hold the exception handler depth.We can then test that in
gen.close()to avoid callinggen.throw()unless necessary.