gh-146388: Add null check for `sym_new(ctx)` in `make_bottom` (GH-146389)
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 0000000..7cf5edf
--- /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 2a8d8c4..0bc3c50 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;
 }