diff -r 58ebfa7c1361 Objects/typeobject.c --- a/Objects/typeobject.c Mon Feb 15 16:51:24 2016 +1100 +++ b/Objects/typeobject.c Wed Feb 24 10:24:03 2016 +0100 @@ -4303,7 +4303,7 @@ wrap_lenfunc(PyObject *self, PyObject *a res = (*func)(self); if (res == -1 && PyErr_Occurred()) return NULL; - return PyInt_FromLong((long)res); + return PyInt_FromSsize_t(res); } static PyObject *