mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
bpo-40024: Add PyModule_AddType() helper function (GH-19088)
This commit is contained in:
parent
b33e52511a
commit
05e4a296ec
10 changed files with 52 additions and 42 deletions
|
@ -441,7 +441,7 @@ state:
|
|||
|
||||
Add an object to *module* as *name*. This is a convenience function which can
|
||||
be used from the module's initialization function. This steals a reference to
|
||||
*value* on success. Return ``-1`` on error, ``0`` on success.
|
||||
*value* on success. Return ``-1`` on error, ``0`` on success.
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -484,6 +484,16 @@ state:
|
|||
|
||||
Add a string constant to *module*.
|
||||
|
||||
.. c:function:: int PyModule_AddType(PyObject *module, PyTypeObject *type)
|
||||
|
||||
Add a type object to *module*.
|
||||
The type object is finalized by calling internally :c:func:`PyType_Ready`.
|
||||
The name of the type object is taken from the last component of
|
||||
:c:member:`~PyTypeObject.tp_name` after dot.
|
||||
Return ``-1`` on error, ``0`` on success.
|
||||
|
||||
.. versionadded:: 3.9
|
||||
|
||||
|
||||
Module lookup
|
||||
^^^^^^^^^^^^^
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue