summaryrefslogtreecommitdiffstats
path: root/Doc/c-api/module.rst
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na92@gmail.com>2020-03-22 16:17:34 (GMT)
committerGitHub <noreply@github.com>2020-03-22 16:17:34 (GMT)
commit05e4a296ecc127641160a04f39cc02c0f66a8c27 (patch)
tree59e73090785087a5e15175c815a20986e59a5728 /Doc/c-api/module.rst
parentb33e52511a59c6da7132c226b7f7489b092a33eb (diff)
downloadcpython-05e4a296ecc127641160a04f39cc02c0f66a8c27.zip
cpython-05e4a296ecc127641160a04f39cc02c0f66a8c27.tar.gz
cpython-05e4a296ecc127641160a04f39cc02c0f66a8c27.tar.bz2
bpo-40024: Add PyModule_AddType() helper function (GH-19088)
Diffstat (limited to 'Doc/c-api/module.rst')
-rw-r--r--Doc/c-api/module.rst12
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst
index 8d1a0fb..8cf26fb 100644
--- a/Doc/c-api/module.rst
+++ b/Doc/c-api/module.rst
@@ -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
^^^^^^^^^^^^^