Skip to content

gh-144986: Fix memory leak in atexit.register()#144987

Open
ashm-dev wants to merge 8 commits intopython:mainfrom
ashm-dev:gh-144986-fix-atexit-memleak
Open

gh-144986: Fix memory leak in atexit.register()#144987
ashm-dev wants to merge 8 commits intopython:mainfrom
ashm-dev:gh-144986-fix-atexit-memleak

Conversation

@ashm-dev
Copy link
Contributor

@ashm-dev ashm-dev commented Feb 19, 2026

PyTuple_GetSlice() in atexit_register() returns a new reference that was never decref'd, leaking a tuple on every atexit.register() call.

Also added a missing NULL check after PyTuple_GetSlice().

@ashm-dev ashm-dev force-pushed the gh-144986-fix-atexit-memleak branch from 9e66555 to 0e0abc3 Compare February 19, 2026 09:19
Copy link
Contributor

@sergey-miryanov sergey-miryanov left a comment

Choose a reason for hiding this comment

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

LGTM

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments