Skip to content

Commit a1bf329

Browse files
authored
bpo-46417: Add missing types of _PyTypes_InitTypes() (GH-30749)
Add types removed by mistake by the commit adding _PyTypes_FiniTypes(). Move also PyBool_Type at the end, since it depends on PyLong_Type. PyBytes_Type and PyUnicode_Type no longer depend explicitly on PyBaseObject_Type: it's the default of PyType_Ready().
1 parent fda8886 commit a1bf329

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Objects/bytesobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2904,7 +2904,7 @@ PyTypeObject PyBytes_Type = {
29042904
bytes_methods, /* tp_methods */
29052905
0, /* tp_members */
29062906
0, /* tp_getset */
2907-
&PyBaseObject_Type, /* tp_base */
2907+
0, /* tp_base */
29082908
0, /* tp_dict */
29092909
0, /* tp_descr_get */
29102910
0, /* tp_descr_set */

Objects/object.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -1841,9 +1841,10 @@ _PyTypes_InitState(PyInterpreterState *interp)
18411841
static PyTypeObject* static_types[] = {
18421842
// base types
18431843
&PyAsyncGen_Type,
1844-
&PyBool_Type,
18451844
&PyByteArrayIter_Type,
18461845
&PyByteArray_Type,
1846+
&PyBytesIter_Type,
1847+
&PyBytes_Type,
18471848
&PyCFunction_Type,
18481849
&PyCallIter_Type,
18491850
&PyCapsule_Type,
@@ -1866,6 +1867,7 @@ static PyTypeObject* static_types[] = {
18661867
&PyDict_Type,
18671868
&PyEllipsis_Type,
18681869
&PyEnum_Type,
1870+
&PyFloat_Type,
18691871
&PyFrame_Type,
18701872
&PyFrozenSet_Type,
18711873
&PyFunction_Type,
@@ -1876,6 +1878,7 @@ static PyTypeObject* static_types[] = {
18761878
&PyListRevIter_Type,
18771879
&PyList_Type,
18781880
&PyLongRangeIter_Type,
1881+
&PyLong_Type,
18791882
&PyMemberDescr_Type,
18801883
&PyMemoryView_Type,
18811884
&PyMethodDescr_Type,
@@ -1897,6 +1900,10 @@ static PyTypeObject* static_types[] = {
18971900
&PyStdPrinter_Type,
18981901
&PySuper_Type,
18991902
&PyTraceBack_Type,
1903+
&PyTupleIter_Type,
1904+
&PyTuple_Type,
1905+
&PyUnicodeIter_Type,
1906+
&PyUnicode_Type,
19001907
&PyWrapperDescr_Type,
19011908
&Py_GenericAliasType,
19021909
&_PyAnextAwaitable_Type,
@@ -1917,6 +1924,7 @@ static PyTypeObject* static_types[] = {
19171924

19181925
// subclasses: _PyTypes_FiniTypes() deallocates them before their base
19191926
// class
1927+
&PyBool_Type, // base=&PyLong_Type
19201928
&PyCMethod_Type, // base=&PyCFunction_Type
19211929
&PyODictItems_Type, // base=&PyDictItems_Type
19221930
&PyODictKeys_Type, // base=&PyDictKeys_Type

Objects/unicodeobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15511,7 +15511,7 @@ PyTypeObject PyUnicode_Type = {
1551115511
unicode_methods, /* tp_methods */
1551215512
0, /* tp_members */
1551315513
0, /* tp_getset */
15514-
&PyBaseObject_Type, /* tp_base */
15514+
0, /* tp_base */
1551515515
0, /* tp_dict */
1551615516
0, /* tp_descr_get */
1551715517
0, /* tp_descr_set */

0 commit comments

Comments
 (0)