diff options
author | Guido van Rossum <guido@python.org> | 2002-06-18 16:44:57 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-06-18 16:44:57 (GMT) |
commit | 63517577fdcd7c17072e1a612f6d91a35030d571 (patch) | |
tree | 14c35b3321d87938e5fafff30d32ad02b272c838 /Objects | |
parent | a0b907581611d19c3b7741f15c59b873009036f4 (diff) | |
download | cpython-63517577fdcd7c17072e1a612f6d91a35030d571.zip cpython-63517577fdcd7c17072e1a612f6d91a35030d571.tar.gz cpython-63517577fdcd7c17072e1a612f6d91a35030d571.tar.bz2 |
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.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 0051179..7918af0 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -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); |