GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-144986: Fix memory leak in atexit.register() by ashm-dev · Pull Request #144987 · python/cpython

Conversation

@ashm-dev

@ashm-dev ashm-dev commented Feb 19, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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().

  • Issue: Memory leak in atexit.register(): missing Py_DECREF for func_args tuple #144986

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ashm-dev
pythongh-144986: Fix memory leak in atexit.register()
2191c56
@ashm-dev
ashm-dev requested review from lysnikolaou and pablogsal as code owners February 19, 2026 07:49
@bedevere-app bedevere-app Bot added the awaiting review label Feb 19, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Feb 19, 2026
Memory leak in atexit.register(): missing Py_DECREF for func_args tuple #144986
Closed
sergey-miryanov
sergey-miryanov reviewed Feb 19, 2026
View reviewed changes
Comment thread Parser/action_helpers.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ashm-dev
fix
0e0abc3
@ashm-dev
ashm-dev force-pushed the gh-144986-fix-atexit-memleak branch from 9e66555 to 0e0abc3 Compare February 19, 2026 09:19
ashm-dev added 2 commits February 19, 2026 12:25
@ashm-dev
Revert unrelated Parser/action_helpers.c change
616a5ca
@ashm-dev
Add NEWS entry for pythongh-144986
28e4533
sergey-miryanov
sergey-miryanov approved these changes Feb 19, 2026
View reviewed changes

@sergey-miryanov sergey-miryanov left a comment

Copy link
Copy Markdown
Contributor

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.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ashm-dev reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Feb 19, 2026
@sergey-miryanov sergey-miryanov added the needs backport to 3.14 bugs and security fixes label Feb 19, 2026
StanFromIreland
StanFromIreland reviewed Feb 19, 2026
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2026-02-19-00-00-00.gh-issue-144986.atexit-leak.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

ashm-dev and others added 3 commits February 19, 2026 12:47
@ashm-dev @StanFromIreland
Update Misc/NEWS.d/next/Library/2026-02-19-00-00-00.gh-issue-144986.a…
c0c2ab5
…texit-leak.rst

Co-authored-by: Stan Ulbrych <[email protected]>
@ashm-dev
Fix missing closing backtick in NEWS entry
73f9048
@ashm-dev
Merge branch 'main' into pythongh-144986-fix-atexit-memleak
aad8a59
@ashm-dev
ashm-dev requested a review from StanFromIreland February 19, 2026 12:18
@ashm-dev
Merge branch 'main' into pythongh-144986-fix-atexit-memleak
c3152f0
pablogsal
pablogsal approved these changes Feb 19, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Feb 19, 2026
@pablogsal

pablogsal commented Feb 19, 2026

Copy link
Copy Markdown
Member

Thanks for the fix @ashm-dev !

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal

pablogsal commented Feb 19, 2026

Copy link
Copy Markdown
Member

Does this affect 3.13?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pablogsal
pablogsal merged commit 50c1471 into python:main Feb 19, 2026
51 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Feb 19, 2026
@miss-islington-app

miss-islington-app Bot commented Feb 19, 2026

Copy link
Copy Markdown

Thanks @ashm-dev for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 19, 2026
@ashm-dev @miss-islington
pythongh-144986: Fix memory leak in atexit.register() (pythonGH-144987)
2065be9
(cherry picked from commit 50c1471)

Co-authored-by: Shamil <[email protected]>
@bedevere-app

bedevere-app Bot commented Feb 19, 2026

Copy link
Copy Markdown

GH-145020 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Feb 19, 2026
@sergey-miryanov

sergey-miryanov commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Does this affect 3.13?

@pablogsal No, it is not. Method was rewritten in 3.14 (3b76682).

pablogsal reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ashm-dev
ashm-dev deleted the gh-144986-fix-atexit-memleak branch February 20, 2026 05:42
@sergey-miryanov sergey-miryanov mentioned this pull request Feb 20, 2026
LeakSan: 80-byte leak at shutdown after atexit.register of bound list.append(-0.0) #140442
Closed
brijkapadia pushed a commit to brijkapadia/cpython that referenced this pull request Feb 28, 2026
@ashm-dev @brijkapadia
pythongh-144986: Fix memory leak in atexit.register() (python#144987)
8e04b79
kumaraditya303 pushed a commit that referenced this pull request Mar 16, 2026
@miss-islington @ashm-dev
[3.14] gh-144986: Fix memory leak in atexit.register() (GH-144987) (#…
a1f2fef
…145020)

gh-144986: Fix memory leak in atexit.register() (GH-144987)
(cherry picked from commit 50c1471)

Co-authored-by: Shamil <[email protected]>
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@ashm-dev @ljfp
pythongh-144986: Fix memory leak in atexit.register() (python#144987)
9dbbcf8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sergey-miryanov sergey-miryanov sergey-miryanov approved these changes
@pablogsal pablogsal pablogsal approved these changes
@lysnikolaou lysnikolaou Awaiting requested review from lysnikolaou
@StanFromIreland StanFromIreland Awaiting requested review from StanFromIreland

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@ashm-dev @pablogsal @sergey-miryanov @StanFromIreland
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.