Uh oh!
There was an error while loading. Please reload this page.
Add PyUnstable_SetImmortal - #164
Conversation
vstinner
left a comment
There was a problem hiding this comment.
Please document the new function in docs/changelog.rst and docs/api.rst.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Victor Stinner <vstinner@python.org>
Uh oh!
There was an error while loading. Please reload this page.
vstinner
left a comment
There was a problem hiding this comment.
I agree to not add Python 3.12 support.
It's tempting to add Python 3.12 support, but Python 3.12 semantics is different:
staticinlinevoid_Py_SetImmortal(PyObject*op)
{
if (op) {
op->ob_refcnt=_Py_IMMORTAL_REFCNT;
}
}- Different API: it has no return value (
void)! - It doesn't reject Unicode objects.
- It doesn't untrack objects in the GC.
// Immortal objects were implemented in Python 3.12, however there is no easy API
// to make objects immortal until 3.14 which has _Py_SetImmortal(). Since
// immortal objects are primarily needed for free-threading, this API is implemented
// for 3.14 using _Py_SetImmortal() and uses private macros on 3.13.
I agree that PyUnstable_SetImmortal() is mostly useful on free-threaded builds, so it's ok to skip Python 3.12.
vstinner
commented
Feb 12, 2026
Good, the tests passed successfully on Python 3.13 on regular build and free-threaded build:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
No description provided.