Skip to content

Commit 78c5b4b

Browse files
committed
address review: rename _PyLong_IsImmortal -> _PyLong_HasImmortalTag
1 parent b892216 commit 78c5b4b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Include/internal/pycore_long.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ _PyLong_IsPositive(const PyLongObject *op)
232232
}
233233

234234
static inline bool
235-
_PyLong_IsImmortal(const PyLongObject *op)
235+
_PyLong_HasImmortalTag(const PyLongObject *op)
236236
{
237237
assert(PyLong_Check(op));
238238
bool is_small_int = (op->long_value.lv_tag & IMMORTALITY_BIT_MASK) != 0;
@@ -303,7 +303,7 @@ _PyLong_SetDigitCount(PyLongObject *op, Py_ssize_t size)
303303
static inline void
304304
_PyLong_FlipSign(PyLongObject *op)
305305
{
306-
assert(!_PyLong_IsImmortal(op));
306+
assert(!_PyLong_HasImmortalTag(op));
307307
unsigned int flipped_sign = 2 - (op->long_value.lv_tag & SIGN_MASK);
308308
op->long_value.lv_tag &= NON_SIZE_MASK;
309309
op->long_value.lv_tag |= flipped_sign;

Modules/_testcapi/immortal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ test_immortal_small_ints(PyObject *self, PyObject *Py_UNUSED(ignored))
3131
for (int i = -5; i <= 1024; i++) {
3232
PyObject *obj = PyLong_FromLong(i);
3333
assert(verify_immortality(obj));
34-
int has_int_immortal_bit = _PyLong_IsImmortal((PyLongObject *)obj);
34+
int has_int_immortal_bit = _PyLong_HasImmortalTag((PyLongObject *)obj);
3535
assert(has_int_immortal_bit);
3636
}
3737
for (int i = 1025; i <= 1030; i++) {
3838
PyObject *obj = PyLong_FromLong(i);
3939
assert(obj);
40-
int has_int_immortal_bit = _PyLong_IsImmortal((PyLongObject *)obj);
40+
int has_int_immortal_bit = _PyLong_HasImmortalTag((PyLongObject *)obj);
4141
assert(!has_int_immortal_bit);
4242
Py_DECREF(obj);
4343
}

Objects/longobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3626,7 +3626,7 @@ void
36263626
_PyLong_ExactDealloc(PyObject *self)
36273627
{
36283628
assert(PyLong_CheckExact(self));
3629-
if (_PyLong_IsImmortal((PyLongObject *)self)) {
3629+
if (_PyLong_HasImmortalTag((PyLongObject *)self)) {
36303630
// See PEP 683, section Accidental De-Immortalizing for details
36313631
_Py_SetImmortal(self);
36323632
return;
@@ -3641,7 +3641,7 @@ _PyLong_ExactDealloc(PyObject *self)
36413641
static void
36423642
long_dealloc(PyObject *self)
36433643
{
3644-
if (_PyLong_IsImmortal((PyLongObject *)self)) {
3644+
if (_PyLong_HasImmortalTag((PyLongObject *)self)) {
36453645
/* This should never get called, but we also don't want to SEGV if
36463646
* we accidentally decref small Ints out of existence. Instead,
36473647
* since small Ints are immortal, re-set the reference count.

0 commit comments

Comments
 (0)