Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 23904:4f0606ceeef8 2.2
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 18 Jun 2002 16:46:57 +0000 |
| parents | 5027e7c12a16 |
| children | e2fa741c547f |
line wrap: on
line diff
--- a/Objects/typeobject.c Tue Jun 18 16:24:15 2002 +0000 +++ b/Objects/typeobject.c Tue Jun 18 16:46:57 2002 +0000 @@ -733,6 +733,11 @@ 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);
