Skip to content

Commit 745387c

Browse files
committed
Removed 'PyMetaType_FromSpecAndBases'.
Added a note about 'PyMetaType_FromModuleAndSpec' in regards to 'tp_new'.
1 parent 5e73355 commit 745387c

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

Doc/c-api/type.rst

+7-9
Original file line numberDiff line numberDiff line change
@@ -161,29 +161,27 @@ The following functions and structs are used to create
161161
If not ``NULL``, the module is associated with the new type and can later be
162162
retreived with :c:func:`PyType_GetModule`.
163163
164-
This function calls :c:func:`PyType_Ready` on the new type.
164+
This function calls :c:func:`PyType_Ready` on the new type.'
165165
166-
.. versionadded:: 3.10
167-
168-
.. c:function:: PyObject* PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
166+
.. note::
169167
170-
Equivalent to ``PyMetaType_FromSpecWithBases(&PyType_Type, spec, bases)``.
168+
This method DOES NOT invoke ``PyTypeObject.tp_new`` on 'meta_type'.
171169
172-
.. versionadded:: 3.3
170+
.. versionadded:: 3.10
173171
174-
.. c:function:: PyObject* PyMetaType_FromSpecWithBases(PyTypeObject *meta_type, PyType_Spec *spec, PyObject *bases)
172+
.. c:function:: PyObject* PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
175173
176174
Equivalent to ``PyMetaType_FromModuleAndSpec(NULL, meta_type, spec, bases)``.
177175
178-
.. versionadded:: 3.10
176+
.. versionadded:: 3.3
179177
180178
.. c:function:: PyObject* PyType_FromSpec(PyType_Spec *spec)
181179
182180
Equivalent to ``PyMetaType_FromSpec(&PyType_Type, spec)``.
183181
184182
.. c:function:: PyObject* PyMetaType_FromSpec(PyTypeObject *meta_type, PyType_Spec *spec)
185183
186-
Equivalent to ``PyMetaType_FromSpecWithBases(meta_type, spec, NULL)``
184+
Equivalent to ``PyMetaType_FromModuleAndSpec(NULL, meta_type, spec, NULL)``
187185
188186
.. versionadded:: 3.10
189187

Include/object.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ typedef struct{
228228
#define PyType_FromSpec(spec) PyMetaType_FromSpec(&PyType_Type, spec)
229229
PyAPI_FUNC(PyObject*) PyMetaType_FromSpec(PyTypeObject*, PyType_Spec*);
230230
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
231-
#define PyType_FromSpecWithBases(spec, bases) PyMetaType_FromSpecWithBases(&PyType_Type, spec, bases)
232-
PyAPI_FUNC(PyObject*) PyMetaType_FromSpecWithBases(PyTypeObject*, PyType_Spec*, PyObject*);
231+
#define PyType_FromSpecWithBases(spec, bases) PyMetaType_FromModuleAndSpec(NULL, &PyType_Type, spec, bases)
233232
#endif
234233
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000
235234
PyAPI_FUNC(void*) PyType_GetSlot(PyTypeObject*, int);

Objects/typeobject.c

+1-7
Original file line numberDiff line numberDiff line change
@@ -2879,12 +2879,6 @@ static const short slotoffsets[] = {
28792879
#include "typeslots.inc"
28802880
};
28812881

2882-
PyObject *
2883-
PyMetaType_FromSpecWithBases(PyTypeObject *meta_type, PyType_Spec *spec, PyObject *bases)
2884-
{
2885-
return PyMetaType_FromModuleAndSpec(NULL, meta_type, spec, bases);
2886-
}
2887-
28882882
PyObject *
28892883
PyMetaType_FromModuleAndSpec(PyObject *module, PyTypeObject *meta_type, PyType_Spec *spec, PyObject *bases)
28902884
{
@@ -3106,7 +3100,7 @@ PyMetaType_FromModuleAndSpec(PyObject *module, PyTypeObject *meta_type, PyType_S
31063100
PyObject *
31073101
PyMetaType_FromSpec(PyTypeObject *meta_type, PyType_Spec *spec)
31083102
{
3109-
return PyMetaType_FromSpecWithBases(meta_type, spec, NULL);
3103+
return PyMetaType_FromModuleAndSpec(NULL, meta_type, spec, NULL);
31103104
}
31113105

31123106
void *

0 commit comments

Comments
 (0)