Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-123091: Use more _Py_IsImmortalLoose() #123602

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Include/internal/pycore_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion Objects/structseq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading