[Python-checkins] cpython: Initialize base types before child types

victor.stinner python-checkins at python.org
Mon Jun 2 14:13:16 CEST 2014


http://hg.python.org/cpython/rev/e4255fa0fdac
changeset:   90963:e4255fa0fdac
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Jun 02 14:10:59 2014 +0200
summary:
  Initialize base types before child types

object (PyBaseObject_Type) is the base type of type (PyType_Type), int
(PyLong_Type) is the base type of bool (PyBool_Type).

files:
  Objects/object.c |  12 ++++++------
  1 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/Objects/object.c b/Objects/object.c
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -1543,6 +1543,9 @@
 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 @@
     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 @@
     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 @@
     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");
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list