diff options
author | Guido van Rossum <guido@python.org> | 2002-08-14 17:26:30 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-08-14 17:26:30 (GMT) |
commit | 323a9cfc8384adca677923cf3c65ad62920c76fa (patch) | |
tree | 83e30dfc5800db4a2d8bced9cf3a641eedcc2ad3 | |
parent | 48d52c0fccb23c213402476992c42664f07cdca1 (diff) | |
download | cpython-323a9cfc8384adca677923cf3c65ad62920c76fa.zip cpython-323a9cfc8384adca677923cf3c65ad62920c76fa.tar.gz cpython-323a9cfc8384adca677923cf3c65ad62920c76fa.tar.bz2 |
PyType_Ready(): initialize the base class a bit earlier, so that if we
copy the metatype from the base, the base actually has one!
-rw-r--r-- | Objects/typeobject.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 62f2822..145923a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2294,6 +2294,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. */ @@ -2312,12 +2318,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) { |