https://github.com/python/cpython/commit/fd4965de331ccbc0bc5003664275f6ccbcac160e commit: fd4965de331ccbc0bc5003664275f6ccbcac160e branch: 3.14 author: Miss Islington (bot) <[email protected]> committer: sobolevn <[email protected]> date: 2026-06-30T11:55:16Z summary:
[3.14] gh-151126: Fix a possible crash during the startup with no memory under `Py_STACKREF_DEBUG` (GH-152478) (#152678) 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 <[email protected]> files: M Python/pystate.c diff --git a/Python/pystate.c b/Python/pystate.c index 06672ceb2143c9..d1505be4acf50f 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -694,6 +694,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, @@ -702,6 +705,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); _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
