Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Intern the outer tuples like any other object
  • Loading branch information
encukou committed Aug 3, 2024
commit b33c1eb3c687b450eb119776a7892a48d27e292a
7 changes: 6 additions & 1 deletion Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,12 @@ intern_constants(PyObject *tuple)
}
if (new_tuple) {
#ifdef Py_GIL_DISABLED
return intern_one_constant(new_tuple);
PyThreadState *tstate = PyThreadState_GET();
if (!_Py_IsImmortal(new_tuple) &&
_Py_atomic_load_int(&tstate->interp->gc.immortalize) >= 0
) {
return intern_one_constant(new_tuple);
}
#endif
return new_tuple;
}
Expand Down