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

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.
üst a0b90758
...@@ -336,6 +336,7 @@ Oscar Nierstrasz ...@@ -336,6 +336,7 @@ Oscar Nierstrasz
Hrvoje Niksic Hrvoje Niksic
Bill Noon Bill Noon
Stefan Norberg Stefan Norberg
Tim Northover
Joe Norton Joe Norton
Neal Norwitz Neal Norwitz
Jeffrey Ollie Jeffrey Ollie
......
...@@ -742,6 +742,11 @@ mro_implementation(PyTypeObject *type) ...@@ -742,6 +742,11 @@ mro_implementation(PyTypeObject *type)
int i, n, ok; int i, n, ok;
PyObject *bases, *result; PyObject *bases, *result;
if(type->tp_dict == NULL) {
if(PyType_Ready(type) < 0)
return NULL;
}
bases = type->tp_bases; bases = type->tp_bases;
n = PyTuple_GET_SIZE(bases); n = PyTuple_GET_SIZE(bases);
result = Py_BuildValue("[O]", (PyObject *)type); result = Py_BuildValue("[O]", (PyObject *)type);
......
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