aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Include/refcount.h
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-03-14 11:13:47 +0000
committerGitHub <noreply@github.com>2025-03-14 13:13:47 +0200
commit2250ab6a13dd269b738cfd391851933fca75533d (patch)
tree3e59e2c3597d6a6289f2e6becd98e1ffa056aeef /Include/refcount.h
parent7fd61607cd28ec466717c78adfb1eb5b63add1f0 (diff)
downloadcpython-2250ab6a13dd269b738cfd391851933fca75533d.tar.gz
cpython-2250ab6a13dd269b738cfd391851933fca75533d.zip
GH-125174 Revert: Make immortality "sticky" (GH-131184)" (#131230)
Revert "GH-125174: Make immortality "sticky" (GH-131184)" This reverts commit 3a91ee97245639c7c4f8852418157d3fc0ec1a82.
Diffstat (limited to 'Include/refcount.h')
-rw-r--r--Include/refcount.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/Include/refcount.h b/Include/refcount.h
index b8ea5c62814..ba14bc6965c 100644
--- a/Include/refcount.h
+++ b/Include/refcount.h
@@ -41,10 +41,6 @@ having all the lower 32 bits set, which will avoid the reference count to go
beyond the refcount limit. Immortality checks for reference count decreases will
be done by checking the bit sign flag in the lower 32 bits.
-To ensure that once an object becomes immortal, it remains immortal, the threshold
-for omitting increfs is much higher than for omitting decrefs. Consequently, once
-the refcount for an object exceeds _Py_IMMORTAL_MINIMUM_REFCNT it will gradually
-increase over time until it reaches _Py_IMMORTAL_INITIAL_REFCNT.
*/
#define _Py_IMMORTAL_INITIAL_REFCNT (3ULL << 30)
#define _Py_IMMORTAL_MINIMUM_REFCNT (1ULL << 31)
@@ -292,7 +288,7 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
}
#elif SIZEOF_VOID_P > 4
PY_UINT32_T cur_refcnt = op->ob_refcnt;
- if (cur_refcnt >= _Py_IMMORTAL_INITIAL_REFCNT) {
+ if (((int32_t)cur_refcnt) < 0) {
// the object is immortal
_Py_INCREF_IMMORTAL_STAT_INC();
return;