]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport:
authorGuido van Rossum <guido@python.org>
Wed, 14 Aug 2002 17:36:26 +0000 (17:36 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 14 Aug 2002 17:36:26 +0000 (17:36 +0000)
PyType_Ready(): initialize the base class a bit earlier, so that if we
copy the metatype from the base, the base actually has one!

Objects/typeobject.c

index 7cf8e488b1be112e91af001203d6e3d51efec2ab..c9c29fe6f300c581e144d486746d79d05ccfc5db 100644 (file)
@@ -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) {