Skip to content

Commit 0b29e28

Browse files
committed
address review: add assert on _PY_IS_SMALL_INT
1 parent 41961ed commit 0b29e28

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Include/internal/pycore_long.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ _PyLong_HasImmortalTag(const PyLongObject *op)
240240
bool is_small_int = (op->long_value.lv_tag & IMMORTALITY_BIT_MASK) != 0;
241241
assert(PyLong_CheckExact(op) || (!is_small_int));
242242
assert(_Py_IsImmortal(op) || (!is_small_int));
243+
assert((_PyLong_IsCompact(op)
244+
&& _PY_IS_SMALL_INT(_PyLong_CompactValue(op)))
245+
|| (!is_small_int));
243246
return is_small_int;
244247
}
245248

0 commit comments

Comments
 (0)