Issue #14630: Fix an incorrect access of ob_digit[0] for a zero instance of an int subclass.

This commit is contained in:
Mark Dickinson 2012-04-20 21:42:49 +01:00
parent 63674f4b52
commit bcc17eefd2
3 changed files with 18 additions and 3 deletions

View file

@ -156,9 +156,7 @@ _PyLong_Copy(PyLongObject *src)
if (i < 0)
i = -(i);
if (i < 2) {
sdigit ival = src->ob_digit[0];
if (Py_SIZE(src) < 0)
ival = -ival;
sdigit ival = MEDIUM_VALUE(src);
CHECK_SMALL_INT(ival);
}
result = _PyLong_New(i);