mirror of
https://github.com/python/cpython.git
synced 2025-11-17 09:30:10 +00:00
PyType_Ready(): initialize the base class a bit earlier, so that if we
copy the metatype from the base, the base actually has one!
This commit is contained in:
parent
48d52c0fcc
commit
323a9cfc83
1 changed files with 6 additions and 6 deletions
|
|
@ -2294,6 +2294,12 @@ PyType_Ready(PyTypeObject *type)
|
||||||
if (base == NULL && type != &PyBaseObject_Type)
|
if (base == NULL && type != &PyBaseObject_Type)
|
||||||
base = type->tp_base = &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
|
/* Initialize ob_type if NULL. This means extensions that want to be
|
||||||
compilable separately on Windows can call PyType_Ready() instead of
|
compilable separately on Windows can call PyType_Ready() instead of
|
||||||
initializing the ob_type field of their type objects. */
|
initializing the ob_type field of their type objects. */
|
||||||
|
|
@ -2312,12 +2318,6 @@ PyType_Ready(PyTypeObject *type)
|
||||||
type->tp_bases = bases;
|
type->tp_bases = bases;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the base class */
|
|
||||||
if (base && base->tp_dict == NULL) {
|
|
||||||
if (PyType_Ready(base) < 0)
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize tp_dict */
|
/* Initialize tp_dict */
|
||||||
dict = type->tp_dict;
|
dict = type->tp_dict;
|
||||||
if (dict == NULL) {
|
if (dict == NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue