gh-146250: Fix memory leak in re-initialization of SyntaxError#146251
Open
bkap123 wants to merge 6 commits intopython:mainfrom
Open
gh-146250: Fix memory leak in re-initialization of SyntaxError#146251bkap123 wants to merge 6 commits intopython:mainfrom
SyntaxError#146251bkap123 wants to merge 6 commits intopython:mainfrom
Conversation
Added `Py_XDECREF`/`Py_XSETREF` to avoid a memory leak when calling `SyntaxError.__init__`.
aisk
reviewed
Mar 21, 2026
Misc/NEWS.d/next/Core_and_Builtins/2026-03-21-11-55-16.gh-issue-146250.ahl3O2.rst
Outdated
Show resolved
Hide resolved
picnixz
reviewed
Mar 21, 2026
Co-authored-by: AN Long <aisk@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Member
|
Sorry about the Py_CLEAR suggestion but I think creating new variables would be cleaner. |
Contributor
Author
|
What's wrong with using |
Member
|
I think it is just better to hold temp vars and use XSETREF like in |
bkap123
commented
Mar 21, 2026
picnixz
reviewed
Mar 21, 2026
Member
|
I will test the refleak bots so don't commit anything until they are done! |
|
🤖 New build scheduled with the buildbot fleet by @picnixz for commit 22cff11 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F146251%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
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.
Added
Py_XDECREF/Py_XSETREFto avoid a memory leak when callingSyntaxError.__init__.SyntaxError.__init__memory leak on re-initialization #146250