]> granicus.if.org Git - python/commitdiff
Patch from SF bug 570483 (Tim Northover).
authorGuido van Rossum <guido@python.org>
Tue, 18 Jun 2002 16:44:57 +0000 (16:44 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 18 Jun 2002 16:44:57 +0000 (16:44 +0000)
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.

Misc/ACKS
Objects/typeobject.c

index c7da1b0354f28c082365682dadcb5116736b07f3..fb649413122c77508a2fd6fb785fd951271dc290 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -336,6 +336,7 @@ Oscar Nierstrasz
 Hrvoje Niksic
 Bill Noon
 Stefan Norberg
+Tim Northover
 Joe Norton
 Neal Norwitz
 Jeffrey Ollie
index 0051179c2f615e0ea9fcb6c021cbaf8c9a6be185..7918af09dbc145871680b38fe312ac97ff14d6d8 100644 (file)
@@ -742,6 +742,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);