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.
8181#else
8282#define PyObject_HEAD_INIT (type ) \
8383 { \
84- { _Py_IMMORTAL_INITIAL_REFCNT }, \
84+ { _Py_STATIC_IMMORTAL_INITIAL_REFCNT }, \
8585 (type) \
8686 },
8787#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
1919cleanup during runtime finalization.
2020*/
2121
22+ /* Leave the low bits for refcount overflow for old stable ABI code */
23+ #define _Py_STATICALLY_ALLOCATED_FLAG (1 << 7)
24+
2225#if SIZEOF_VOID_P > 4
2326/*
2427In 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
3942be done by checking the bit sign flag in the lower 32 bits.
4043
4144*/
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)))
4347
4448#else
4549/*
@@ -60,9 +64,6 @@ check by comparing the reference count field to the minimum immortality refcount
6064#define _Py_STATIC_IMMORTAL_MINIMUM_REFCNT ((Py_ssize_t)(6L << 28))
6165#endif
6266
63- /* Leave the low bits for refcount overflow for old stable ABI code */
64- #define _Py_STATICALLY_ALLOCATED_FLAG (1 << 7)
65-
6667// Py_GIL_DISABLED builds indicate immortal objects using `ob_ref_local`, which is
6768// always 32-bits.
6869#ifdef Py_GIL_DISABLED
You can’t perform that action at this time.
0 commit comments