check = self.check_sizeof
# bool
check(True, vsize('') + self.longdigit)
+ check(False, vsize('') + self.longdigit)
# buffer
# XXX
# builtin_function_or_method
# listreverseiterator (list)
check(reversed([]), size('nP'))
# int
- check(0, vsize(''))
+ check(0, vsize('') + self.longdigit)
check(1, vsize('') + self.longdigit)
check(-1, vsize('') + self.longdigit)
PyLong_BASE = 2**sys.int_info.bits_per_digit
{
Py_ssize_t res;
- res = offsetof(PyLongObject, ob_digit) + Py_ABS(Py_SIZE(self))*sizeof(digit);
+ res = offsetof(PyLongObject, ob_digit)
+ /* using Py_MAX(..., 1) because we always allocate space for at least
+ one digit, even though the integer zero has a Py_SIZE of 0 */
+ + Py_MAX(Py_ABS(Py_SIZE(self)), 1)*sizeof(digit);
return res;
}