diff -r 6e6aa2054824 Objects/tupleobject.c --- a/Objects/tupleobject.c Sat Aug 20 21:22:03 2016 +0300 +++ b/Objects/tupleobject.c Sun Aug 21 17:26:07 2016 -0700 @@ -355,7 +355,13 @@ x = 0x345678UL; p = v->ob_item; while (--len >= 0) { - y = PyObject_Hash(*p++); + PyObject *next = *p++; + if (next == NULL) { + PyErr_SetString(PyExc_TypeError, + "Cannot compute a hash, tuple seems to be invalid"); + return -1; + } + y = PyObject_Hash(next); if (y == -1) return -1; x = (x ^ y) * mult;