From c8ee196030b1af7ccf347567e263075ffb1aeee8 Mon Sep 17 00:00:00 2001 From: Brandon Date: Fri, 27 Mar 2026 09:50:29 -0500 Subject: [PATCH] gh-146388: Add null check for `sym_new(ctx)` in `make_bottom` (GH-146389) --- .../2026-03-26-11-18-45.gh-issue-146388.O0u1c3.rst | 1 + Python/optimizer_symbols.c | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-03-26-11-18-45.gh-issue-146388.O0u1c3.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-03-26-11-18-45.gh-issue-146388.O0u1c3.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-26-11-18-45.gh-issue-146388.O0u1c3.rst new file mode 100644 index 00000000000..7cf5edfe8c6 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-26-11-18-45.gh-issue-146388.O0u1c3.rst @@ -0,0 +1 @@ +Adds a null check to handle when the JIT optimizer runs out of space when dealing with contradictions in ``make_bottom``. diff --git a/Python/optimizer_symbols.c b/Python/optimizer_symbols.c index 2a8d8c45c58..0bc3c505581 100644 --- a/Python/optimizer_symbols.c +++ b/Python/optimizer_symbols.c @@ -1684,6 +1684,9 @@ static JitOptSymbol * make_bottom(JitOptContext *ctx) { JitOptSymbol *sym = sym_new(ctx); + if (sym == NULL) { + return out_of_space(ctx); + } sym->tag = JIT_SYM_BOTTOM_TAG; return sym; }