https://github.com/python/cpython/commit/a615fb49c948902a982c3256899507abcc9f9bc8
commit: a615fb49c948902a982c3256899507abcc9f9bc8
branch: main
author: Shamil <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-10-20T09:29:23Z
summary:

gh-140301: Fix memory leak in subinterpreter `PyConfig` cleanup (#140303)

Co-authored-by: Kumar Aditya <[email protected]>

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2025-10-18-18-08-36.gh-issue-140301.m-2HxC.rst
M Python/pystate.c

diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2025-10-18-18-08-36.gh-issue-140301.m-2HxC.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-10-18-18-08-36.gh-issue-140301.m-2HxC.rst
new file mode 100644
index 00000000000000..8b1c81c04ece92
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-10-18-18-08-36.gh-issue-140301.m-2HxC.rst
@@ -0,0 +1 @@
+Fix memory leak of ``PyConfig`` in subinterpreters.
diff --git a/Python/pystate.c b/Python/pystate.c
index af7828d6a030ab..955457cdcf5c28 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -963,6 +963,8 @@ PyInterpreterState_Delete(PyInterpreterState *interp)
 
     _PyObject_FiniState(interp);
 
+    PyConfig_Clear(&interp->config);
+
     free_interpreter(interp);
 }
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to