Skip to content

Improve module.rst C-API docs #121615

@sobolevn

Description

@sobolevn

There are multiple places in https://github.com/python/cpython/blob/main/Doc/c-api/module.rst where exception are not mentioned in the docs.

Like:

Return 0 on success or -1 on failure.

Some functions do not even declare that they can return NULL. Like:

.. c:function:: PyObject * PyModule_FromDefAndSpec2(PyModuleDef *def, PyObject *spec, int module_api_version)
Create a new module object, given the definition in *def* and the
ModuleSpec *spec*, assuming the API version *module_api_version*.
If that version does not match the version of the running interpreter,
a :exc:`RuntimeWarning` is emitted.
.. note::
Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec`
instead; only use this if you are sure you need it.
.. versionadded:: 3.5

I will send a PR with the fix.

Linked PRs

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions