gh-144307: fix refcount leak in finalize_remove_modules()#144308
Merged
ZeroIntensity merged 2 commits intopython:mainfrom Jan 29, 2026
Merged
gh-144307: fix refcount leak in finalize_remove_modules()#144308ZeroIntensity merged 2 commits intopython:mainfrom
finalize_remove_modules()#144308ZeroIntensity merged 2 commits intopython:mainfrom
Conversation
`PyIter_Next()` returns a new reference, but `finalize_remove_modules()` failed to DECREF `key` when `PyObject_GetItem()`` returns NULL. Fix by DECREF'ing `key` before continuing. Signed-off-by: Yongtao Huang <[email protected]>
Member
ZeroIntensity
left a comment
There was a problem hiding this comment.
This is user-facing so it needs a news entry.
Contributor
Author
Thanks for your reminder. |
|
Thanks @hyongtao-code for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jan 29, 2026
…H-144308) (cherry picked from commit 219b7ac) Co-authored-by: Yongtao Huang <[email protected]> Signed-off-by: Yongtao Huang <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
|
Sorry, @hyongtao-code and @ZeroIntensity, I could not cleanly backport this to |
|
GH-144327 is a backport of this pull request to the 3.14 branch. |
|
GH-144328 is a backport of this pull request to the 3.13 branch. |
ZeroIntensity
pushed a commit
to ZeroIntensity/cpython
that referenced
this pull request
Jan 29, 2026
…ythonGH-144308) (cherry picked from commit 219b7ac) Co-authored-by: Yongtao Huang <[email protected]> Signed-off-by: Yongtao Huang <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
ZeroIntensity
added a commit
that referenced
this pull request
Jan 29, 2026
) (GH-144328) (cherry picked from commit 219b7ac) Signed-off-by: Yongtao Huang <[email protected]> Co-authored-by: Yongtao Huang <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
ZeroIntensity
pushed a commit
that referenced
this pull request
Jan 29, 2026
) (GH-144327) gh-144307: Fix a reference leak during module teardown (GH-144308) (cherry picked from commit 219b7ac) Signed-off-by: Yongtao Huang <[email protected]> Co-authored-by: Yongtao Huang <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
thunder-coding
pushed a commit
to thunder-coding/cpython
that referenced
this pull request
Feb 15, 2026
…H-144308) Signed-off-by: Yongtao Huang <[email protected]> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PyIter_Next()returns a new reference, butfinalize_remove_modules()failed to DECREFkeywhenPyObject_GetItem()returns NULL. Fix by DECREF'ingkeybefore continuing.finalize_remove_modules()#144307