Bug report
Bug description:
Immortal objects should live forever. By definition, immortality is a permanent property of an object; if it can loose immortality, then it wasn't immortal in the first place.
Immortality allows some useful optimizations and safety guarantees that can make CPython faster and more robust.
Which would be great, if we didn't play fast and loose with immortality.
For no good reason that I'm aware of there are two functions _Py_ClearImmortal and _Py_SetMortal that make immortal objects mortal. This is nonsense. We must remove these functions.
We have also added _Py_IsImmortalLoose because it is too easy for C-extensions
Instead of adding these workarounds, we need to fix this problem as well.
Let's fix immortality so that we can rely on it and take advantage of it.
CPython versions tested on:
3.12, 3.13, CPython main branch
Operating systems tested on:
Other
Linked PRs
Bug report
Bug description:
Immortal objects should live forever. By definition, immortality is a permanent property of an object; if it can loose immortality, then it wasn't immortal in the first place.
Immortality allows some useful optimizations and safety guarantees that can make CPython faster and more robust.
Which would be great, if we didn't play fast and loose with immortality.
For no good reason that I'm aware of there are two functions
_Py_ClearImmortaland_Py_SetMortalthat make immortal objects mortal. This is nonsense. We must remove these functions.We have also added
_Py_IsImmortalLoosebecause it is too easy for C-extensionsInstead of adding these workarounds, we need to fix this problem as well.
Let's fix immortality so that we can rely on it and take advantage of it.
CPython versions tested on:
3.12, 3.13, CPython main branch
Operating systems tested on:
Other
Linked PRs
UINT32_MAXin header file #127863