Skip to content

Commit ddff596

Browse files
committed
Down downgrade from static immortal to plain immortal
1 parent 7aefe57 commit ddff596

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Objects/object.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2521,6 +2521,10 @@ _Py_SetImmortalUntracked(PyObject *op)
25212521
|| PyUnicode_CHECK_INTERNED(op) == SSTATE_INTERNED_IMMORTAL_STATIC);
25222522
}
25232523
#endif
2524+
// Check if already immortal to avoid degrading from static immortal to plain immortal
2525+
if (_Py_IsImmortal(op)) {
2526+
return;
2527+
}
25242528
#ifdef Py_GIL_DISABLED
25252529
op->ob_tid = _Py_UNOWNED_TID;
25262530
op->ob_ref_local = _Py_IMMORTAL_REFCNT_LOCAL;

0 commit comments

Comments
 (0)