@@ -181,11 +181,13 @@ Type Objects
181181 Python's default memory allocation mechanism to allocate a new instance and
182182 initialize all its contents to ``NULL ``.
183183
184+
184185.. c :function :: PyObject* PyType_GenericNew (PyTypeObject *type, PyObject *args, PyObject *kwds)
185186
186187 Generic handler for the :c:member: `~PyTypeObject.tp_new ` slot of a type object. Create a
187188 new instance using the type's :c:member: `~PyTypeObject.tp_alloc ` slot.
188189
190+
189191.. c :function :: int PyType_Ready (PyTypeObject *type)
190192
191193 Finalize a type object. This should be called on all type objects to finish
@@ -202,13 +204,15 @@ Type Objects
202204 GC protocol itself by at least implementing the
203205 :c:member: `~PyTypeObject.tp_traverse ` handle.
204206
207+
205208.. c :function :: PyObject* PyType_GetName (PyTypeObject *type)
206209
207210 Return the type's name. Equivalent to getting the type's
208211 :attr: `~type.__name__ ` attribute.
209212
210213 .. versionadded :: 3.11
211214
215+
212216.. c :function :: PyObject* PyType_GetQualName (PyTypeObject *type)
213217
214218 Return the type's qualified name. Equivalent to getting the
@@ -224,13 +228,15 @@ Type Objects
224228
225229 .. versionadded :: 3.13
226230
231+
227232.. c :function :: PyObject* PyType_GetModuleName (PyTypeObject *type)
228233
229234 Return the type's module name. Equivalent to getting the
230235 :attr: `type.__module__ ` attribute.
231236
232237 .. versionadded :: 3.13
233238
239+
234240.. c :function :: void * PyType_GetSlot (PyTypeObject *type, int slot)
235241
236242 Return the function pointer stored in the given slot. If the
@@ -247,6 +253,7 @@ Type Objects
247253 :c:func: `PyType_GetSlot ` can now accept all types.
248254 Previously, it was limited to :ref: `heap types <heap-types >`.
249255
256+
250257.. c :function :: PyObject* PyType_GetModule (PyTypeObject *type)
251258
252259 Return the module object associated with the given type when the type was
@@ -266,6 +273,7 @@ Type Objects
266273
267274 .. versionadded :: 3.9
268275
276+
269277.. c :function :: void * PyType_GetModuleState (PyTypeObject *type)
270278
271279 Return the state of the module object associated with the given type.
@@ -280,6 +288,7 @@ Type Objects
280288
281289 .. versionadded :: 3.9
282290
291+
283292.. c :function :: PyObject* PyType_GetModuleByDef (PyTypeObject *type, struct PyModuleDef *def)
284293
285294 Find the first superclass whose module was created from
@@ -299,6 +308,7 @@ Type Objects
299308
300309 .. versionadded:: 3.11
301310
311+
302312.. c:function:: int PyUnstable_Type_AssignVersionTag(PyTypeObject *type)
303313
304314 Attempt to assign a version tag to the given type.
@@ -309,6 +319,16 @@ Type Objects
309319 .. versionadded :: 3.12
310320
311321
322+ .. c :function :: int PyType_SUPPORTS_WEAKREFS (PyTypeObject *type)
323+
324+ Return true if instances of *type * support creating weak references, false
325+ otherwise. This function always succeeds. *type * must not be ``NULL ``.
326+
327+ .. seealso ::
328+ * :ref: `weakrefobjects `
329+ * :py:mod: `weakref `
330+
331+
312332Creating Heap-Allocated Types
313333.............................
314334
@@ -361,6 +381,7 @@ The following functions and structs are used to create
361381
362382 .. versionadded:: 3.12
363383
384+
364385.. c:function:: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases)
365386
366387 Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases) ``.
@@ -383,6 +404,7 @@ The following functions and structs are used to create
383404 :c:member: `~PyTypeObject.tp_new ` is deprecated and in Python 3.14+ it
384405 will be no longer allowed.
385406
407+
386408.. c :function :: PyObject* PyType_FromSpecWithBases (PyType_Spec *spec, PyObject *bases)
387409
388410 Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases) ``.
@@ -400,6 +422,7 @@ The following functions and structs are used to create
400422 :c:member: `~PyTypeObject.tp_new ` is deprecated and in Python 3.14+ it
401423 will be no longer allowed.
402424
425+
403426.. c :function :: PyObject* PyType_FromSpec (PyType_Spec *spec)
404427
405428 Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL) ``.
0 commit comments