Skip to content

gh-146102: Avoid possibe memory leak in pylifecycle.c - #151534

Open
IvyXu420 wants to merge 2 commits into
python:mainfrom
IvyXu420:fix-146102
Open

IvyXu420 wants to merge 2 commits into
python:mainfrom
IvyXu420:fix-146102

Conversation

@IvyXu420

@IvyXu420 IvyXu420 commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

@Wulian233

Copy link
Copy Markdown
Contributor

I have already made a similar PR before. However, if yours is better, I will close mine
#149631

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Sep 17, 2026

@BHUVANSH855 BHUVANSH855 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you have a look on these points.

Comment thread Python/pylifecycle.c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pycore_init_builtins still leaks bimod on the _PyBuiltin_InitPythonFunctions early return (inside config->_install_importlib). Also the two fixed sites should be Py_DECREF not Py_XDECREF, bimod is non-NULL there.

new_interpreter: _PyObject_InitState and _PyStats_InterpInit failure checks still return status instead of goto error, skipping _PyThreadState_Attach.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No tests were added. I think Lib/test/test_interpreters/test_lifecycle.py would be right place.

NEWS entry should reference gh-149630, not gh-146102 (that's the umbrella).

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

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants