Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5a1bb4e

Browse files
committed
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).
1 parent 7df3c15 commit 5a1bb4e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Objects/object.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,6 +1543,9 @@ PyObject _Py_NotImplementedStruct = {
15431543
void
15441544
_Py_ReadyTypes(void)
15451545
{
1546+
if (PyType_Ready(&PyBaseObject_Type) < 0)
1547+
Py_FatalError("Can't initialize object type");
1548+
15461549
if (PyType_Ready(&PyType_Type) < 0)
15471550
Py_FatalError("Can't initialize type type");
15481551

@@ -1555,6 +1558,9 @@ _Py_ReadyTypes(void)
15551558
if (PyType_Ready(&_PyWeakref_ProxyType) < 0)
15561559
Py_FatalError("Can't initialize weakref proxy type");
15571560

1561+
if (PyType_Ready(&PyLong_Type) < 0)
1562+
Py_FatalError("Can't initialize int type");
1563+
15581564
if (PyType_Ready(&PyBool_Type) < 0)
15591565
Py_FatalError("Can't initialize bool type");
15601566

@@ -1579,9 +1585,6 @@ _Py_ReadyTypes(void)
15791585
if (PyType_Ready(&PySuper_Type) < 0)
15801586
Py_FatalError("Can't initialize super type");
15811587

1582-
if (PyType_Ready(&PyBaseObject_Type) < 0)
1583-
Py_FatalError("Can't initialize object type");
1584-
15851588
if (PyType_Ready(&PyRange_Type) < 0)
15861589
Py_FatalError("Can't initialize range type");
15871590

@@ -1606,9 +1609,6 @@ _Py_ReadyTypes(void)
16061609
if (PyType_Ready(&PyFloat_Type) < 0)
16071610
Py_FatalError("Can't initialize float type");
16081611

1609-
if (PyType_Ready(&PyLong_Type) < 0)
1610-
Py_FatalError("Can't initialize int type");
1611-
16121612
if (PyType_Ready(&PyFrozenSet_Type) < 0)
16131613
Py_FatalError("Can't initialize frozenset type");
16141614

0 commit comments

Comments
 (0)