diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2012-06-22 10:20:55 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2012-06-22 10:20:55 (GMT) |
commit | 7800f75827b1be557be16f3b18f5170fbf9fae08 (patch) | |
tree | e4fc657f32119fddf3881ce54bfe89535838c22e /Doc | |
parent | 7f59fd7c7c3315c52034b09ffadeb974bc112b5d (diff) | |
download | cpython-7800f75827b1be557be16f3b18f5170fbf9fae08.zip cpython-7800f75827b1be557be16f3b18f5170fbf9fae08.tar.gz cpython-7800f75827b1be557be16f3b18f5170fbf9fae08.tar.bz2 |
Issue #15042: Add PyState_AddModule and PyState_RemoveModule.
Add version guard for Py_LIMITED_API additions.
Issue #15081: Document PyState_FindModule.
Patch by Robin Schreiber.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/module.rst | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 32587be..3be7fe3 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -113,8 +113,28 @@ There are only a few functions special to module objects. Return a pointer to the :c:type:`PyModuleDef` struct from which the module was created, or *NULL* if the module wasn't created with - :c:func:`PyModule_Create`. + :c:func:`PyModule_Create`.i +.. c:function:: PyObject* PyState_FindModule(PyModuleDef *def) + + Returns the module object that was created from *def* for the current interpreter. + This method requires that the module object has been attached to the interpreter state with + :c:func:`PyState_AddModule` beforehand. In case the corresponding module object is not + found or has not been attached to the interpreter state yet, it returns NULL. + +.. c:function:: int PyState_AddModule(PyModuleDef *def, PyObject *module) + + Attaches the module object passed to the function to the interpreter state. This allows + the module object to be accessible via + :c:func:`PyState_FindModule`. + + .. versionadded:: 3.3 + +.. c:function:: int PyState_RemoveModule(PyModuleDef *def, PyObject *module) + + Removes the module object created from *def* from the interpreter state. + + .. versionadded:: 3.3 Initializing C modules ^^^^^^^^^^^^^^^^^^^^^^ |