File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ whose size is determined when the object is allocated.
81
81
#else
82
82
#define PyObject_HEAD_INIT (type ) \
83
83
{ \
84
- { _Py_IMMORTAL_INITIAL_REFCNT }, \
84
+ { _Py_STATIC_IMMORTAL_INITIAL_REFCNT }, \
85
85
(type) \
86
86
},
87
87
#endif
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ immortal. The latter should be the only instances that require
19
19
cleanup during runtime finalization.
20
20
*/
21
21
22
+ /* Leave the low bits for refcount overflow for old stable ABI code */
23
+ #define _Py_STATICALLY_ALLOCATED_FLAG (1 << 7)
24
+
22
25
#if SIZEOF_VOID_P > 4
23
26
/*
24
27
In 64+ bit systems, any object whose 32 bit reference count is >= 2**31
@@ -39,7 +42,8 @@ beyond the refcount limit. Immortality checks for reference count decreases will
39
42
be done by checking the bit sign flag in the lower 32 bits.
40
43
41
44
*/
42
- #define _Py_IMMORTAL_INITIAL_REFCNT ((Py_ssize_t)(3UL << 30))
45
+ #define _Py_IMMORTAL_INITIAL_REFCNT (3UL << 30)
46
+ #define _Py_STATIC_IMMORTAL_INITIAL_REFCNT ((Py_ssize_t)(_Py_IMMORTAL_INITIAL_REFCNT | (((Py_ssize_t)_Py_STATICALLY_ALLOCATED_FLAG) << 32)))
43
47
44
48
#else
45
49
/*
@@ -60,9 +64,6 @@ check by comparing the reference count field to the minimum immortality refcount
60
64
#define _Py_STATIC_IMMORTAL_MINIMUM_REFCNT ((Py_ssize_t)(6L << 28))
61
65
#endif
62
66
63
- /* Leave the low bits for refcount overflow for old stable ABI code */
64
- #define _Py_STATICALLY_ALLOCATED_FLAG (1 << 7)
65
-
66
67
// Py_GIL_DISABLED builds indicate immortal objects using `ob_ref_local`, which is
67
68
// always 32-bits.
68
69
#ifdef Py_GIL_DISABLED
You can’t perform that action at this time.
0 commit comments