From 12f9ed39bc6368165b49655e53314f8952eeb404 Mon Sep 17 00:00:00 2001 From: Yongtao Huang Date: Wed, 1 Apr 2026 15:58:28 +0800 Subject: [PATCH 1/3] Fix: avoid memory leak in _tuple_shared() on allocation failure --- Python/crossinterp_data_lookup.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Python/crossinterp_data_lookup.h b/Python/crossinterp_data_lookup.h index cf84633e10e356..54422ad2335cb6 100644 --- a/Python/crossinterp_data_lookup.h +++ b/Python/crossinterp_data_lookup.h @@ -657,6 +657,7 @@ _tuple_shared(PyThreadState *tstate, PyObject *obj, xidata_fallback_t fallback, shared->items = (_PyXIData_t **) PyMem_Calloc(shared->len, sizeof(_PyXIData_t *)); if (shared->items == NULL) { PyErr_NoMemory(); + PyMem_RawFree(shared); return -1; } From a05f5918480e0cb112d742c89a994b4177a6c39b Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 08:16:16 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst new file mode 100644 index 00000000000000..ea2fde55128f5e --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst @@ -0,0 +1 @@ +Fix a memory leak in ``_tuple_shared()`` when allocation of the internal items array fails. From 373dfada9b34433d57763977ce0c613f48ec5f9a Mon Sep 17 00:00:00 2001 From: Yongtao Huang Date: Wed, 1 Apr 2026 17:24:48 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Revert=20"=F0=9F=93=9C=F0=9F=A4=96=20Added?= =?UTF-8?q?=20by=20blurb=5Fit."?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a05f5918480e0cb112d742c89a994b4177a6c39b. --- .../2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst deleted file mode 100644 index ea2fde55128f5e..00000000000000 --- a/Misc/NEWS.d/next/Core_and_Builtins/2026-04-01-08-16-14.gh-issue-147960.iUeF5e.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a memory leak in ``_tuple_shared()`` when allocation of the internal items array fails.