diff -r 908b801f8a62 Objects/longobject.c --- a/Objects/longobject.c Fri Jul 01 12:33:25 2016 +0300 +++ b/Objects/longobject.c Sat Jul 02 11:09:35 2016 +0300 @@ -314,7 +314,6 @@ v = _PyLong_New(ndigits); if (v != NULL) { digit *p = v->ob_digit; - Py_SIZE(v) = ndigits; while (ival) { *p++ = (digit)(ival & PyLong_MASK); ival >>= PyLong_SHIFT; @@ -1079,7 +1078,8 @@ v = _PyLong_New(ndigits); if (v != NULL) { digit *p = v->ob_digit; - Py_SIZE(v) = negative ? -ndigits : ndigits; + if (negative) + Py_SIZE(v) = -ndigits; t = abs_ival; while (t) { *p++ = (digit)(t & PyLong_MASK); @@ -1109,7 +1109,6 @@ v = _PyLong_New(ndigits); if (v != NULL) { digit *p = v->ob_digit; - Py_SIZE(v) = ndigits; while (ival) { *p++ = (digit)(ival & PyLong_MASK); ival >>= PyLong_SHIFT; @@ -1148,7 +1147,8 @@ v = _PyLong_New(ndigits); if (v != NULL) { digit *p = v->ob_digit; - Py_SIZE(v) = negative ? -ndigits : ndigits; + if (negative) + Py_SIZE(v) = -ndigits; t = abs_ival; while (t) { *p++ = (digit)(t & PyLong_MASK); @@ -1178,7 +1178,6 @@ v = _PyLong_New(ndigits); if (v != NULL) { digit *p = v->ob_digit; - Py_SIZE(v) = ndigits; while (ival) { *p++ = (digit)(ival & PyLong_MASK); ival >>= PyLong_SHIFT; diff -r 908b801f8a62 Python/marshal.c --- a/Python/marshal.c Fri Jul 01 12:33:25 2016 +0300 +++ b/Python/marshal.c Sat Jul 02 11:09:35 2016 +0300 @@ -802,7 +802,8 @@ if (ob == NULL) return NULL; - Py_SIZE(ob) = n > 0 ? size : -size; + if (n <= 0) + Py_SIZE(ob) = -size; for (i = 0; i < size-1; i++) { d = 0;