Python 3.12's Immortals: Singletons Skip Ref-Counting

Beginning with Python 3.12 (PEP 683), objects such as `None`, `True`, `False`, and small integers are marked as 'immortal,' meaning their reference counts are fixed to a special value, allowing `Py_INCREF`/`Py_DECREF` functions to bypass them entirely, enhancing performance and enabling true immutability.

Sources

Open the full topic