Skip to content

Commit

Permalink
Make objects stored in global containers immortal.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsnowcurrently committed Mar 22, 2023
1 parent 6216207 commit ca776b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Python/pystate.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,11 @@ _Py_AddToGlobalDict(PyObject *dict, PyObject *key, PyObject *value)

release_global_objects_lock(runtime);

// XXX Immortalize the key and value.
/* Immortalize the key and value. */
_Py_SetImmortal(key);
if (value != key) {
_Py_SetImmortal(value);
}

return actual;
}
Expand Down

0 comments on commit ca776b1

Please sign in to comment.