From: Guido van Rossum Date: Tue, 18 Jun 2002 16:46:57 +0000 (+0000) Subject: Backport: X-Git-Tag: v2.2.2b1~314 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=36d0d694270e91bdb61b55ea28e612a35a3d101c;p=thirdparty%2FPython%2Fcpython.git Backport: Patch from SF bug 570483 (Tim Northover). In a fresh interpreter, type.mro(tuple) would segfault, because PyType_Ready() isn't called for tuple yet. To fix, call PyType_Ready(type) if type->tp_dict is NULL. --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index ca5140c17fa3..09e4aa7e945c 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -733,6 +733,11 @@ mro_implementation(PyTypeObject *type) int i, n, ok; PyObject *bases, *result; + if(type->tp_dict == NULL) { + if(PyType_Ready(type) < 0) + return NULL; + } + bases = type->tp_bases; n = PyTuple_GET_SIZE(bases); result = Py_BuildValue("[O]", (PyObject *)type);