We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7aefe57 commit ddff596Copy full SHA for ddff596
Objects/object.c
@@ -2521,6 +2521,10 @@ _Py_SetImmortalUntracked(PyObject *op)
2521
|| PyUnicode_CHECK_INTERNED(op) == SSTATE_INTERNED_IMMORTAL_STATIC);
2522
}
2523
#endif
2524
+ // Check if already immortal to avoid degrading from static immortal to plain immortal
2525
+ if (_Py_IsImmortal(op)) {
2526
+ return;
2527
+ }
2528
#ifdef Py_GIL_DISABLED
2529
op->ob_tid = _Py_UNOWNED_TID;
2530
op->ob_ref_local = _Py_IMMORTAL_REFCNT_LOCAL;
0 commit comments