diff -r dbdc95931fa7 Objects/typeobject.c --- a/Objects/typeobject.c Sat Jun 25 16:43:26 2016 -0700 +++ b/Objects/typeobject.c Sun Jun 26 09:25:55 2016 +0300 @@ -4908,7 +4908,9 @@ PyType_Ready(PyTypeObject *type) } /* All bases of statically allocated type should be statically allocated */ - if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) + if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { + bases = type->tp_bases; + n = PyTuple_GET_SIZE(bases); for (i = 0; i < n; i++) { PyObject *b = PyTuple_GET_ITEM(bases, i); if (PyType_Check(b) && @@ -4920,6 +4922,7 @@ PyType_Ready(PyTypeObject *type) goto error; } } + } /* Sanity check for tp_free. */ if (PyType_IS_GC(type) && (type->tp_flags & Py_TPFLAGS_BASETYPE) &&