[3.13] gh-123091: Use _Py_IsImmortalLoose() (#123511) (#123600)

gh-123091: Use _Py_IsImmortalLoose() (#123511)

Use _Py_IsImmortalLoose() in bytesobject.c, typeobject.c
and ceval.c.

(cherry picked from commit f1a0d96f41)
This commit is contained in:
Victor Stinner 2024-09-02 15:23:29 +02:00 committed by GitHub
parent b76a4a5db7
commit 10735bff9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 17 additions and 17 deletions

View file

@ -452,7 +452,7 @@ set_tp_bases(PyTypeObject *self, PyObject *bases, int initial)
assert(PyTuple_GET_SIZE(bases) == 1);
assert(PyTuple_GET_ITEM(bases, 0) == (PyObject *)self->tp_base);
assert(self->tp_base->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
assert(_Py_IsImmortal(self->tp_base));
assert(_Py_IsImmortalLoose(self->tp_base));
}
_Py_SetImmortal(bases);
}
@ -469,7 +469,7 @@ clear_tp_bases(PyTypeObject *self, int final)
Py_CLEAR(self->tp_bases);
}
else {
assert(_Py_IsImmortal(self->tp_bases));
assert(_Py_IsImmortalLoose(self->tp_bases));
_Py_ClearImmortal(self->tp_bases);
}
}
@ -534,7 +534,7 @@ clear_tp_mro(PyTypeObject *self, int final)
Py_CLEAR(self->tp_mro);
}
else {
assert(_Py_IsImmortal(self->tp_mro));
assert(_Py_IsImmortalLoose(self->tp_mro));
_Py_ClearImmortal(self->tp_mro);
}
}
@ -5657,7 +5657,7 @@ fini_static_type(PyInterpreterState *interp, PyTypeObject *type,
int isbuiltin, int final)
{
assert(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
assert(_Py_IsImmortal((PyObject *)type));
assert(_Py_IsImmortalLoose((PyObject *)type));
type_dealloc_common(type);