-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
GH-100964: Fix reference cycle in exhausted generator frames #141112
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-100964: Fix reference cycle in exhausted generator frames #141112
Conversation
|
@markshannon Are you still the right person to take a look at this 😄 ? |
|
I came across this bug today while writing an asyncio test and this fixed it. ping @markshannon for review |
markshannon
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.
Nice fix
Misc/NEWS.d/next/Core_and_Builtins/2025-11-06-05-21-25.gh-issue-100964.TxPf1b.rst
Outdated
Show resolved
Hide resolved
|
Thanks @savannahostrowski for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…ythonGH-141112) (cherry picked from commit 92243dc62ce10715ab0d9074b23dea5a1bfa9dcc) Co-authored-by: Savannah Ostrowski <[email protected]>
|
Sorry, @savannahostrowski, I could not cleanly backport this to |
|
GH-142902 is a backport of this pull request to the 3.14 branch. |
…G… (#142904) * [3.13] GH-100964: Fix reference cycle in exhausted generator frames (GH-141112) (cherry picked from commit 92243dc) Co-authored-by: Savannah Ostrowski <[email protected]>
So after spelunking here it appears that the issue here is that we can't clear
frame->previousafter_PyFrame_ClearExceptCodeinclear_gen_framebecause_PyFrame_ClearExceptCodecallstake_ownershipwhich copies the frame with a stalepreviouspointer. This makesf_backpoint to the caller, instead ofNone.