Skip to content

gh-148263: Fix refcount leak in weakref proxy operations#148308

Closed
prakashsellathurai wants to merge 48 commits intopython:mainfrom
prakashsellathurai:fix/148263
Closed

gh-148263: Fix refcount leak in weakref proxy operations#148308
prakashsellathurai wants to merge 48 commits intopython:mainfrom
prakashsellathurai:fix/148263

Conversation

@prakashsellathurai
Copy link
Copy Markdown

@prakashsellathurai prakashsellathurai commented Apr 9, 2026

Validation:

Reproducer scripts -> https://gist.github.com/prakashsellathurai/ea7ba0ec8a5cf049881464d34de31411

before (mainline )

(venv) PS C:\Users\Prakash\Documents\work\projects\mainline> .\python.bat ..\cpython\tmp\final-test.py
Running Debug|x64 interpreter...
binary +: leaked 10003 refs (~1/call)
ternary pow: leaked 10003 refs (~1/call)
compare ==: leaked 10003 refs (~1/call)

After this change

(venv) PS C:\Users\Prakash\Documents\work\projects\cpython> .\python.bat  .\tmp\final-test.py
Running Debug|x64 interpreter...
binary +: leaked 3 refs (~0/call)
ternary pow: leaked 3 refs (~0/call)
compare ==: leaked 3 refs (~0/call)

@bedevere-app
Copy link
Copy Markdown

bedevere-app bot commented Apr 9, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Copy link
Copy Markdown
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer that we keep a macro form to calls. In addition, please follow PEP-7.

@prakashsellathurai prakashsellathurai changed the title gh-148263: Fix UNWRAP ref leak with dead proxy gh-148263: Fix refcount leak in weakref proxy binary/ternary operations and proxy_richcompare Apr 12, 2026
@prakashsellathurai prakashsellathurai changed the title gh-148263: Fix refcount leak in weakref proxy binary/ternary operations and proxy_richcompare gh-148263: Fix refcount leak in weakref proxy operations Apr 12, 2026
…resources.files()` when module spec is `None`" (python#148460)"

This reverts commit 480edc1.
…__` and `__delattr__` in frozen dataclasses with slots (pythonGH-144021)"

This reverts commit 8a398bf.
This reverts commit f8d0fbb.
This reverts commit 70f1cca.
This reverts commit 30d2369.
This reverts commit b432655.
@prakashsellathurai
Copy link
Copy Markdown
Author

while debugging few failed testcases multiple commits from main was reverted hence closing this pr and creating fresh pr only with my changes

@prakashsellathurai
Copy link
Copy Markdown
Author

prakashsellathurai commented Apr 13, 2026

I would prefer that we keep a macro form to calls. In addition, please follow PEP-7.

I fixed the PEP-7 issues but when i tried to change the function calls to macro, and removing the new proxy wrapper for unary /wrap method, mainline downstream testcases were failing/went flaky , in doing so created multiple reverts which clouded the current PR ,hence raising a new pr with clean changes here #148486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants