GeezerVison is showing github.com — gh-100762: Fix optimization in gen_close by iritkatriel · Pull Request #111069 · python/cpython
Conversation
iritkatriel
commented
Oct 19, 2023
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
In f02fa64 lines 383-389 were added, with returns that do not decref yf. I think this is ok because yf is always NULL in these cases. Adding the assertions.
Also, the optimization for the case of exception_handler_depth== 1 is not working because op.code is checked instead of op.arg.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
iritkatriel
changed the title
gh-100762: fix refleak in gen_close
gh-100762: assert that yf is NULL in gen_close in the cases where it is not DECREFed
Oct 19, 2023
iritkatriel
changed the title
gh-100762: assert that yf is NULL in gen_close in the cases where it is not DECREFed
gh-100762: Fix optimization in gen_close and assert that yf is NULL in the cases where it is not DECREFed
Oct 19, 2023
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
One minor efficiency improvement that could be made is to not call _PyGen_yf(gen) until after the checks for FRAME_CREATED and FRAME_COMPLETED.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
iritkatriel
changed the title
gh-100762: Fix optimization in gen_close and assert that yf is NULL in the cases where it is not DECREFed
gh-100762: Fix optimization in gen_close
Oct 24, 2023
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
|
Would it be possible / make sense to cherry-pick this change onto 3.12?
For pylint / astroid we're seeing ValueError: generator already executing errors since 3.12.0b1. We haven't been able to create a standalone reproducer - which is also the reason I haven't opened a bug report yet. However testing either 3.13.0a2 or 3.12 with this change cherry-picked on top does seem to resolve it as best as I can tell.
pylint-dev/pylint#9138
|
matejsp reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Would it be possible / make sense to cherry-pick this change onto 3.12?
I think so. I'll make a PR.
|
cdce8p reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @iritkatriel for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|