diff -r eaee5aed6fbc Objects/longobject.c --- a/Objects/longobject.c Thu May 26 12:19:42 2016 -0700 +++ b/Objects/longobject.c Sat May 28 19:39:41 2016 +0300 @@ -3022,8 +3022,14 @@ if (Py_SIZE(a) < 0) { if (Py_SIZE(b) < 0) { z = x_add(a, b); - if (z != NULL && Py_SIZE(z) != 0) + if (z != NULL) { + /* x_add received two multiple-digit ints, so z must + be a multiple-digit int. + That also means that z is not an element of + small_ints, so negating it in-place is safe. */ + assert(Py_ABS(Py_SIZE(z)) > 1); Py_SIZE(z) = -(Py_SIZE(z)); + } } else z = x_sub(b, a); @@ -3054,7 +3060,7 @@ z = x_sub(a, b); else z = x_add(a, b); - if (z != NULL && Py_SIZE(z) != 0) + if (z != NULL) Py_SIZE(z) = -(Py_SIZE(z)); } else {