From dabf8ac514f02e6de55c4420a07a9479a86ba6a6 Mon Sep 17 00:00:00 2001 From: Eldar Abusalimov Date: Sat, 25 Oct 2014 22:55:16 +0400 Subject: [PATCH 13/15] (fix) mro_implementation: check base->tp_mro is not NULL --- Objects/typeobject.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 4f58926..45bf6f1 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1722,6 +1722,13 @@ mro_implementation(PyTypeObject *type) PyObject *base_mro_aslist; base = (PyTypeObject *)PyTuple_GET_ITEM(bases, i); + if (base->tp_mro == NULL) { + PyErr_Format(PyExc_TypeError, + "Cannot extend an incomplete type '%.100s'", + base->tp_name); + goto out; + } + base_mro_aslist = PySequence_List(base->tp_mro); if (base_mro_aslist == NULL) goto out; -- 2.1.1