From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 30 Jun 2026 11:56:43 +0000 (+0200) Subject: [3.15] gh-151126: Fix a possible crash during the startup with no memory under `Py_ST... X-Git-Tag: v3.15.0b4~182 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f3e91b1f87697fe143032577f3e2f0f964fe672;p=thirdparty%2FPython%2Fcpython.git [3.15] gh-151126: Fix a possible crash during the startup with no memory under `Py_STACKREF_DEBUG` (GH-152478) (#152677) gh-151126: Fix a possible crash during the startup with no memory under `Py_STACKREF_DEBUG` (GH-152478) (cherry picked from commit ecdef1773006529b0fea6639d0effeecbb41679c) Co-authored-by: sobolevn --- diff --git a/Python/pystate.c b/Python/pystate.c index b0c924adbe0f..8349df1b5739 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -655,6 +655,9 @@ init_interpreter(PyInterpreterState *interp, NULL, &alloc ); + if (interp->open_stackrefs_table == NULL) { + return _PyStatus_NO_MEMORY(); + } # ifdef Py_STACKREF_CLOSE_DEBUG interp->closed_stackrefs_table = _Py_hashtable_new_full( _Py_hashtable_hash_ptr, @@ -663,6 +666,9 @@ init_interpreter(PyInterpreterState *interp, NULL, &alloc ); + if (interp->closed_stackrefs_table == NULL) { + return _PyStatus_NO_MEMORY(); + } # endif _Py_stackref_associate(interp, Py_None, PyStackRef_None); _Py_stackref_associate(interp, Py_False, PyStackRef_False);