https://github.com/python/cpython/commit/d655c655619d8a6b7eec908a7b7c770d5f2ac0f8
commit: d655c655619d8a6b7eec908a7b7c770d5f2ac0f8
branch: 3.13
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2024-09-03T12:36:42+02:00
summary:
[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 57c471a6880956338549380fc5fb35c986937901)
files:
M Modules/_asynciomodule.c
M Objects/structseq.c
M Python/import.c
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 3babd33eaabf45..4b0aa0503f5231 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -1333,7 +1333,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 94f09b3ee0a337..ee3dbf9d4c047a 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 88f6a7ab57a20c..1056ddd370befb 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1048,7 +1048,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;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]