Skip to content

Commit d655c65

Browse files
authored
[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 57c471a)
1 parent 7761ddc commit d655c65

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Diff for: Modules/_asynciomodule.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ FutureObj_get_state(FutureObj *fut, void *Py_UNUSED(ignored))
13331333
default:
13341334
assert (0);
13351335
}
1336-
assert(_Py_IsImmortal(ret));
1336+
assert(_Py_IsImmortalLoose(ret));
13371337
return ret;
13381338
}
13391339

Diff for: Objects/structseq.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ _PyStructSequence_FiniBuiltin(PyInterpreterState *interp, PyTypeObject *type)
725725
assert(type->tp_name != NULL);
726726
assert(type->tp_base == &PyTuple_Type);
727727
assert((type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN));
728-
assert(_Py_IsImmortal(type));
728+
assert(_Py_IsImmortalLoose(type));
729729

730730
// Cannot delete a type if it still has subclasses
731731
if (_PyType_HasSubclasses(type)) {

Diff for: Python/import.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ del_cached_def(struct extensions_cache_value *value)
10481048
However, this decref would be problematic if the module def were
10491049
dynamically allocated, it were the last ref, and this function
10501050
were called with an interpreter other than the def's owner. */
1051-
assert(value->def == NULL || _Py_IsImmortal(value->def));
1051+
assert(value->def == NULL || _Py_IsImmortalLoose(value->def));
10521052

10531053
Py_XDECREF(value->def->m_base.m_copy);
10541054
value->def->m_base.m_copy = NULL;

0 commit comments

Comments
 (0)