summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-05-24 21:41:26 (GMT)
committerGuido van Rossum <guido@python.org>2002-05-24 21:41:26 (GMT)
commit6d36fd8401bcdc46a082c4920782942e2374ee0b (patch)
tree0f50b2d9fd318ea3d671611d1e4a564084b688f2 /Objects
parent1cac6dbd076fe0bf29761779ad93a49f69553280 (diff)
downloadcpython-6d36fd8401bcdc46a082c4920782942e2374ee0b.zip
cpython-6d36fd8401bcdc46a082c4920782942e2374ee0b.tar.gz
cpython-6d36fd8401bcdc46a082c4920782942e2374ee0b.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/typeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 74dfff9..f5a1a01 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -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++) {