diff options
author | Petr Viktorin <encukou@gmail.com> | 2024-09-02 16:17:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 16:17:48 (GMT) |
commit | 57c471a6880956338549380fc5fb35c986937901 (patch) | |
tree | 57833b1f0b12f5408dc75b67afe3d3384d677e45 | |
parent | 5002f17794a9f403540305c733698d1e01699490 (diff) | |
download | cpython-57c471a6880956338549380fc5fb35c986937901.zip cpython-57c471a6880956338549380fc5fb35c986937901.tar.gz cpython-57c471a6880956338549380fc5fb35c986937901.tar.bz2 |
gh-123091: Use more _Py_IsImmortalLoose() (GH-123602)
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.
-rw-r--r-- | Include/internal/pycore_object.h | 4 | ||||
-rw-r--r-- | Modules/_asynciomodule.c | 2 | ||||
-rw-r--r-- | Objects/structseq.c | 2 | ||||
-rw-r--r-- | Python/import.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h index 2ef0aae..64ff44b 100644 --- a/Include/internal/pycore_object.h +++ b/Include/internal/pycore_object.h @@ -314,7 +314,7 @@ static inline void _Py_INCREF_TYPE(PyTypeObject *type) { if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) { - assert(_Py_IsImmortal(type)); + assert(_Py_IsImmortalLoose(type)); return; } @@ -354,7 +354,7 @@ static inline void _Py_DECREF_TYPE(PyTypeObject *type) { if (!_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE)) { - assert(_Py_IsImmortal(type)); + assert(_Py_IsImmortalLoose(type)); return; } diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 0a769c4..8700841 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1387,7 +1387,7 @@ FutureObj_get_state(FutureObj *fut, void *Py_UNUSED(ignored)) default: assert (0); } - assert(_Py_IsImmortal(ret)); + assert(_Py_IsImmortalLoose(ret)); return ret; } diff --git a/Objects/structseq.c b/Objects/structseq.c index 94f09b3..ee3dbf9 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -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)) { diff --git a/Python/import.c b/Python/import.c index c9212ec..a5ea0e2 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1049,7 +1049,7 @@ del_cached_def(struct extensions_cache_value *value) However, this decref would be problematic if the module def were dynamically allocated, it were the last ref, and this function were called with an interpreter other than the def's owner. */ - assert(value->def == NULL || _Py_IsImmortal(value->def)); + assert(value->def == NULL || _Py_IsImmortalLoose(value->def)); Py_XDECREF(value->def->m_base.m_copy); value->def->m_base.m_copy = NULL; |