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 00000000000..8b1c81c04ec --- /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 68207443532..ba62a93d457 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -985,6 +985,8 @@ PyInterpreterState_Delete(PyInterpreterState *interp) _PyObject_FiniState(interp); + PyConfig_Clear(&interp->config); + free_interpreter(interp); }