From a615fb49c948902a982c3256899507abcc9f9bc8 Mon Sep 17 00:00:00 2001 From: Shamil Date: Mon, 20 Oct 2025 12:29:23 +0300 Subject: [PATCH] gh-140301: Fix memory leak in subinterpreter `PyConfig` cleanup (#140303) Co-authored-by: Kumar Aditya --- .../2025-10-18-18-08-36.gh-issue-140301.m-2HxC.rst | 1 + Python/pystate.c | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-10-18-18-08-36.gh-issue-140301.m-2HxC.rst 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 af7828d6a030..955457cdcf5c 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); } -- 2.47.3