[3.14] gh-138192: Fix Context initialization so that all subinterpreters are assigned the MISSING value. (gh-138503) (#138505)

Co-authored-by: Donghee Na <donghee.na@python.org>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-09-05 14:30:04 +02:00 committed by GitHub
parent b6fa945ff9
commit cddb7e6a7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 4 deletions

View file

@ -1357,11 +1357,8 @@ get_token_missing(void)
PyStatus
_PyContext_Init(PyInterpreterState *interp)
{
if (!_Py_IsMainInterpreter(interp)) {
return _PyStatus_OK();
}
PyObject *missing = get_token_missing();
assert(PyUnstable_IsImmortal(missing));
if (PyDict_SetItemString(
_PyType_GetDict(&PyContextToken_Type), "MISSING", missing))
{