mirror of
https://github.com/python/cpython
synced 2026-09-29 08:20:29 +03:00
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.
This commit is contained in:
parent
a0b9075816
commit
63517577fd
2 changed files with 6 additions and 0 deletions
|
|
@ -336,6 +336,7 @@ Oscar Nierstrasz
|
|||
Hrvoje Niksic
|
||||
Bill Noon
|
||||
Stefan Norberg
|
||||
Tim Northover
|
||||
Joe Norton
|
||||
Neal Norwitz
|
||||
Jeffrey Ollie
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue