From dcf5de8de6d84d7bd6d9bce1b57f4fa550aea7e5 Mon Sep 17 00:00:00 2001 From: "zainnadeem(RedOpsCell)" Date: Thu, 25 Jun 2026 11:42:38 +0500 Subject: [PATCH] gh-151763: Fix OOM cleanup of initial thread state --- .../next/Library/2026-06-25-11-52-00.gh-issue-151763.mW3xQp.rst | 2 ++ Python/pystate.c | 1 + 2 files changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2026-06-25-11-52-00.gh-issue-151763.mW3xQp.rst diff --git a/Misc/NEWS.d/next/Library/2026-06-25-11-52-00.gh-issue-151763.mW3xQp.rst b/Misc/NEWS.d/next/Library/2026-06-25-11-52-00.gh-issue-151763.mW3xQp.rst new file mode 100644 index 000000000000000..60f6b5b0a7552dc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-06-25-11-52-00.gh-issue-151763.mW3xQp.rst @@ -0,0 +1,2 @@ +Fixed a possible crash during interpreter creation when memory allocation +fails in the free-threaded build. diff --git a/Python/pystate.c b/Python/pystate.c index fed1df0173bacf1..e0030bf136e05a9 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1505,6 +1505,7 @@ alloc_threadstate(PyInterpreterState *interp) } reset_threadstate(tstate); } + tstate->base.interp = interp; return tstate; }