diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-04-02-13-25-09.gh-issue-147998.wnzkRT.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-02-13-25-09.gh-issue-147998.wnzkRT.rst new file mode 100644 index 00000000000000..e83d9929eae5e0 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-02-13-25-09.gh-issue-147998.wnzkRT.rst @@ -0,0 +1,3 @@ +Fixed a memory leak in interpreter helper calls so cleanup works when an +operation falls across interpreter boundaries. Patch by Maurycy +Pawłowski-Wieroński. diff --git a/Python/crossinterp.c b/Python/crossinterp.c index f92927da475321..783ce3a237088c 100644 --- a/Python/crossinterp.c +++ b/Python/crossinterp.c @@ -2965,7 +2965,7 @@ _pop_preserved(_PyXI_session *session, *p_xidata = NULL; } else { - _PyXI_namespace *xidata = _create_sharedns(session->_preserved); + xidata = _create_sharedns(session->_preserved); if (xidata == NULL) { failure.code = _PyXI_ERR_PRESERVE_FAILURE; goto error;