-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[mypyc] Fix memory leak on property setter call #21095
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
Merged
p-sawicki
merged 9 commits into
python:master
from
p-sawicki:add-decref-after-property-setter-call
Mar 24, 2026
+181
−6
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f1b5d67
Add decref
p-sawicki 6482508
Update test
p-sawicki bea3c66
Add comment
p-sawicki e548a82
Check if passed value is refcounted
p-sawicki 52d4a58
Don't mark prop set source as stolen in SetAttr
p-sawicki 1990b6d
Disable test on 32-bit python
p-sawicki 26bd874
Use is_propset in emitfunc
p-sawicki d8e8a11
Fix determination of propset in multimodule compilation
p-sawicki b73f03a
Use is_propset in emitfunc again
p-sawicki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Check if passed value is refcounted
- Loading branch information
commit e548a8208c8eba2393b49adcbb0842c191a7323b
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
A potentially cleaner approach would be to adjust
stolenofSetAttrfor properties -- i.e. don't steal the value if it's a property. Thoughts?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.
ah good call, this way the decref is visible in the IR which makes for better tests.
i've removed the leak test from the run test as it seemed a little flaky when running it multiple times in a row.
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.
looks like the failures were actually an implementation mistake - using
ClassIR.methodsduring IR generation may not work in multimodule compilation because theSetAttrconstructor might run before the property setter method is added in the other module.i've changed it to use
ClassIR.method_declsinstead which is populated in prepare.py so it's safe to use.