Mercurial > cpython-lru_cache-weakref
diff Objects/typeobject.c @ 24826:a7dbe4e7f5de 2.2
Backport:
PyType_Ready(): initialize the base class a bit earlier, so that if we
copy the metatype from the base, the base actually has one!
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 14 Aug 2002 17:36:26 +0000 |
| parents | ebc8667f325a |
| children | 0690ea6d1153 |
line wrap: on
line diff
--- a/Objects/typeobject.c Wed Aug 14 15:27:19 2002 +0000 +++ b/Objects/typeobject.c Wed Aug 14 17:36:26 2002 +0000 @@ -2114,6 +2114,12 @@ if (base == NULL && type != &PyBaseObject_Type) base = type->tp_base = &PyBaseObject_Type; + /* Initialize the base class */ + if (base && base->tp_dict == NULL) { + if (PyType_Ready(base) < 0) + goto error; + } + /* Initialize ob_type if NULL. This means extensions that want to be compilable separately on Windows can call PyType_Ready() instead of initializing the ob_type field of their type objects. */ @@ -2132,12 +2138,6 @@ type->tp_bases = bases; } - /* Initialize the base class */ - if (base && base->tp_dict == NULL) { - if (PyType_Ready(base) < 0) - goto error; - } - /* Initialize tp_dict */ dict = type->tp_dict; if (dict == NULL) {
