Kaydet (Commit) 6d36fd84 authored tarafından Guido van Rossum's avatar Guido van Rossum

Fix for SF bug 551412. When _PyType_Lookup() is called on a type

whose tp_mro hasn't been initialized, it would dump core.  Fix this by
checking for NULL and calling PyType_Ready().  Backport from 2.3.
üst 1cac6dbd
......@@ -1218,6 +1218,12 @@ _PyType_Lookup(PyTypeObject *type, PyObject *name)
/* Look in tp_dict of types in MRO */
mro = type->tp_mro;
if (mro == NULL) {
if (PyType_Ready(type) < 0)
return NULL;
mro = type->tp_mro;
assert(mro != NULL);
}
assert(PyTuple_Check(mro));
n = PyTuple_GET_SIZE(mro);
for (i = 0; i < n; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment