[3.13] gh-123091: Use more _Py_IsImmortalLoose() (GH-123602) (GH-123622)

Switch more _Py_IsImmortal(...) assertions to _Py_IsImmortalLoose(...)

The remaining calls to _Py_IsImmortal are in free-threaded-only code,
initialization of core objects, tests, and guards that fall back to
code that works with mortal objects.

(cherry picked from commit 57c471a688)
This commit is contained in:
Petr Viktorin 2024-09-03 12:36:42 +02:00 committed by GitHub
parent 7761ddcfed
commit d655c65561
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -725,7 +725,7 @@ _PyStructSequence_FiniBuiltin(PyInterpreterState *interp, PyTypeObject *type)
assert(type->tp_name != NULL);
assert(type->tp_base == &PyTuple_Type);
assert((type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN));
assert(_Py_IsImmortal(type));
assert(_Py_IsImmortalLoose(type));
// Cannot delete a type if it still has subclasses
if (_PyType_HasSubclasses(type)) {