]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46417: Add missing types of _PyTypes_InitTypes() (GH-30749)
authorVictor Stinner <vstinner@python.org>
Fri, 21 Jan 2022 16:53:13 +0000 (17:53 +0100)
committerGitHub <noreply@github.com>
Fri, 21 Jan 2022 16:53:13 +0000 (17:53 +0100)
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().

Objects/bytesobject.c
Objects/object.c
Objects/unicodeobject.c

index 85d6912ca751fced0ef527564a2d302dbaf86f3d..b6edfb9acb2dbb593a6d4eca6dd2590845bc292c 100644 (file)
@@ -2904,7 +2904,7 @@ PyTypeObject PyBytes_Type = {
     bytes_methods,                              /* tp_methods */
     0,                                          /* tp_members */
     0,                                          /* tp_getset */
-    &PyBaseObject_Type,                         /* tp_base */
+    0,                                          /* tp_base */
     0,                                          /* tp_dict */
     0,                                          /* tp_descr_get */
     0,                                          /* tp_descr_set */
index dc2cba2ebccec0c521480acd9c672b80647117f0..a5ee8eef4a3b490c8ac656b3d907dcdb4ac6741a 100644 (file)
@@ -1841,9 +1841,10 @@ _PyTypes_InitState(PyInterpreterState *interp)
 static PyTypeObject* static_types[] = {
     // base types
     &PyAsyncGen_Type,
-    &PyBool_Type,
     &PyByteArrayIter_Type,
     &PyByteArray_Type,
+    &PyBytesIter_Type,
+    &PyBytes_Type,
     &PyCFunction_Type,
     &PyCallIter_Type,
     &PyCapsule_Type,
@@ -1866,6 +1867,7 @@ static PyTypeObject* static_types[] = {
     &PyDict_Type,
     &PyEllipsis_Type,
     &PyEnum_Type,
+    &PyFloat_Type,
     &PyFrame_Type,
     &PyFrozenSet_Type,
     &PyFunction_Type,
@@ -1876,6 +1878,7 @@ static PyTypeObject* static_types[] = {
     &PyListRevIter_Type,
     &PyList_Type,
     &PyLongRangeIter_Type,
+    &PyLong_Type,
     &PyMemberDescr_Type,
     &PyMemoryView_Type,
     &PyMethodDescr_Type,
@@ -1897,6 +1900,10 @@ static PyTypeObject* static_types[] = {
     &PyStdPrinter_Type,
     &PySuper_Type,
     &PyTraceBack_Type,
+    &PyTupleIter_Type,
+    &PyTuple_Type,
+    &PyUnicodeIter_Type,
+    &PyUnicode_Type,
     &PyWrapperDescr_Type,
     &Py_GenericAliasType,
     &_PyAnextAwaitable_Type,
@@ -1917,6 +1924,7 @@ static PyTypeObject* static_types[] = {
 
     // subclasses: _PyTypes_FiniTypes() deallocates them before their base
     // class
+    &PyBool_Type,         // base=&PyLong_Type
     &PyCMethod_Type,      // base=&PyCFunction_Type
     &PyODictItems_Type,   // base=&PyDictItems_Type
     &PyODictKeys_Type,    // base=&PyDictKeys_Type
index 31b8710defbea6a9733d39c15085f57001ce4612..2e1f8a6ac4e5657404c47577a0ba6913cc505e92 100644 (file)
@@ -15511,7 +15511,7 @@ PyTypeObject PyUnicode_Type = {
     unicode_methods,              /* tp_methods */
     0,                            /* tp_members */
     0,                            /* tp_getset */
-    &PyBaseObject_Type,           /* tp_base */
+    0,                            /* tp_base */
     0,                            /* tp_dict */
     0,                            /* tp_descr_get */
     0,                            /* tp_descr_set */