@@ -84,17 +84,15 @@ typedef struct _typeobject PyTypeObject;
84
84
/*
85
85
Immortalization:
86
86
87
- This marks the reference count bit that will be used to define immortality.
88
- The GC bit-shifts refcounts left by two, and after that shift it still needs
89
- to be larger than zero, so it's placed after the first three high bits.
90
-
91
- For backwards compatibility the actual reference count of an immortal instance
92
- is set to higher than just the immortal bit. This will ensure that the immortal
93
- bit will remain active, even with extensions compiled without the updated checks
94
- in Py_INCREF and Py_DECREF. This can be safely changed to a smaller value if
95
- additional bits are needed in the reference count field.
87
+ This marks the reference count bit that will be used to define immortality which
88
+ is set right after the sign bit. For backwards compatibility the actual
89
+ reference count of an immortal instance is set to higher than the immortal bit.
90
+ This will ensure that the immortal bit will remain active, even with extensions
91
+ compiled without the updated checks in Py_INCREF and Py_DECREF.
92
+ This extra value can be safely changed to a smaller value if additional bits are
93
+ needed in the reference count field.
96
94
*/
97
- #define _Py_IMMORTAL_BIT_OFFSET (8 * sizeof(Py_ssize_t) - 4 )
95
+ #define _Py_IMMORTAL_BIT_OFFSET (8 * sizeof(Py_ssize_t) - 2 )
98
96
#define _Py_IMMORTAL_BIT (1LL << _Py_IMMORTAL_BIT_OFFSET)
99
97
#define _Py_IMMORTAL_REFCNT (_Py_IMMORTAL_BIT + (_Py_IMMORTAL_BIT / 2))
100
98
@@ -105,8 +103,6 @@ additional bits are needed in the reference count field.
105
103
#define PyObject_HEAD_IMMORTAL_INIT (type ) \
106
104
{ _PyObject_EXTRA_INIT _Py_IMMORTAL_REFCNT, type },
107
105
108
- // TODO(eduardo-elizondo): This is only used to simplify the review of GH-19474
109
- // Rather than changing this API, we'll introduce PyVarObject_HEAD_IMMORTAL_INIT
110
106
#define PyVarObject_HEAD_INIT (type , size ) \
111
107
{ PyObject_HEAD_IMMORTAL_INIT(type) size },
112
108
0 commit comments