Skip to content

Commit ca776b1

Browse files
Make objects stored in global containers immortal.
1 parent 6216207 commit ca776b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Python/pystate.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,11 @@ _Py_AddToGlobalDict(PyObject *dict, PyObject *key, PyObject *value)
677677

678678
release_global_objects_lock(runtime);
679679

680-
// XXX Immortalize the key and value.
680+
/* Immortalize the key and value. */
681+
_Py_SetImmortal(key);
682+
if (value != key) {
683+
_Py_SetImmortal(value);
684+
}
681685

682686
return actual;
683687
}

0 commit comments

Comments
 (0)