]> granicus.if.org Git - python/commitdiff
Initialize base types before child types
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 2 Jun 2014 12:10:59 +0000 (14:10 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 2 Jun 2014 12:10:59 +0000 (14:10 +0200)
object (PyBaseObject_Type) is the base type of type (PyType_Type), int
(PyLong_Type) is the base type of bool (PyBool_Type).

Objects/object.c

index a1a69fa123e68468be49d06a1999cfea190899eb..b9ae23a9ce46ab1d0c401c0a112189dd1e13a5d9 100644 (file)
@@ -1543,6 +1543,9 @@ PyObject _Py_NotImplementedStruct = {
 void
 _Py_ReadyTypes(void)
 {
+    if (PyType_Ready(&PyBaseObject_Type) < 0)
+        Py_FatalError("Can't initialize object type");
+
     if (PyType_Ready(&PyType_Type) < 0)
         Py_FatalError("Can't initialize type type");
 
@@ -1555,6 +1558,9 @@ _Py_ReadyTypes(void)
     if (PyType_Ready(&_PyWeakref_ProxyType) < 0)
         Py_FatalError("Can't initialize weakref proxy type");
 
+    if (PyType_Ready(&PyLong_Type) < 0)
+        Py_FatalError("Can't initialize int type");
+
     if (PyType_Ready(&PyBool_Type) < 0)
         Py_FatalError("Can't initialize bool type");
 
@@ -1579,9 +1585,6 @@ _Py_ReadyTypes(void)
     if (PyType_Ready(&PySuper_Type) < 0)
         Py_FatalError("Can't initialize super type");
 
-    if (PyType_Ready(&PyBaseObject_Type) < 0)
-        Py_FatalError("Can't initialize object type");
-
     if (PyType_Ready(&PyRange_Type) < 0)
         Py_FatalError("Can't initialize range type");
 
@@ -1606,9 +1609,6 @@ _Py_ReadyTypes(void)
     if (PyType_Ready(&PyFloat_Type) < 0)
         Py_FatalError("Can't initialize float type");
 
-    if (PyType_Ready(&PyLong_Type) < 0)
-        Py_FatalError("Can't initialize int type");
-
     if (PyType_Ready(&PyFrozenSet_Type) < 0)
         Py_FatalError("Can't initialize frozenset type");