From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 20 Oct 2025 09:54:41 +0000 (+0200) Subject: [3.14] gh-140301: Fix memory leak in subinterpreter `PyConfig` cleanup (GH-140303... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d7fe4e99a2d1b660d444876c721c8889b8a9fd28;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-140301: Fix memory leak in subinterpreter `PyConfig` cleanup (GH-140303) (#140360) gh-140301: Fix memory leak in subinterpreter `PyConfig` cleanup (GH-140303) (cherry picked from commit a615fb49c948902a982c3256899507abcc9f9bc8) Co-authored-by: Shamil Co-authored-by: Kumar Aditya --- 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 000000000000..8b1c81c04ece --- /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 7f365ea50cab..06f997fb5ad5 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1049,6 +1049,8 @@ PyInterpreterState_Delete(PyInterpreterState *interp) _PyObject_FiniState(interp); + PyConfig_Clear(&interp->config); + free_interpreter(interp); }