From: Guido van Rossum Date: Wed, 14 Aug 2002 17:36:26 +0000 (+0000) Subject: Backport: X-Git-Tag: v2.2.2b1~219 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6f53956a329a561f9deff10335ebb2ae44c813cb;p=thirdparty%2FPython%2Fcpython.git 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! --- diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 7cf8e488b1be..c9c29fe6f300 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2114,6 +2114,12 @@ PyType_Ready(PyTypeObject *type) 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 @@ PyType_Ready(PyTypeObject *type) 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) {