From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 17 Dec 2022 07:19:54 +0000 (-0800) Subject: gh-97909: Fix markup for `PyMethodDef` members (GH-100089) X-Git-Tag: v3.10.10~114 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e38a525c20f0fe68cfade983a472a1f011d5e3df;p=thirdparty%2FPython%2Fcpython.git gh-97909: Fix markup for `PyMethodDef` members (GH-100089) (cherry picked from commit 8edcb30c3f8bdd8099a093146fedbd9b63a3f667) Co-authored-by: ram vikram singh --- diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 069774745654..4ad85d0428a0 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -235,29 +235,30 @@ Implementing functions and methods Structure used to describe a method of an extension type. This structure has four fields: - +------------------+---------------+-------------------------------+ - | Field | C Type | Meaning | - +==================+===============+===============================+ - | :attr:`ml_name` | const char \* | name of the method | - +------------------+---------------+-------------------------------+ - | :attr:`ml_meth` | PyCFunction | pointer to the C | - | | | implementation | - +------------------+---------------+-------------------------------+ - | :attr:`ml_flags` | int | flag bits indicating how the | - | | | call should be constructed | - +------------------+---------------+-------------------------------+ - | :attr:`ml_doc` | const char \* | points to the contents of the | - | | | docstring | - +------------------+---------------+-------------------------------+ + .. c:member:: const char* ml_name + + name of the method + + .. c:member:: PyCFunction ml_meth + + pointer to the C implementation + + .. c:member:: int ml_flags + + flags bits indicating how the call should be constructed + + .. c:member:: const char* ml_doc + + points to the contents of the docstring -The :attr:`ml_meth` is a C function pointer. The functions may be of different +The :c:member:`ml_meth` is a C function pointer. The functions may be of different types, but they always return :c:expr:`PyObject*`. If the function is not of the :c:type:`PyCFunction`, the compiler will require a cast in the method table. Even though :c:type:`PyCFunction` defines the first parameter as :c:expr:`PyObject*`, it is common that the method implementation uses the specific C type of the *self* object. -The :attr:`ml_flags` field is a bitfield which can include the following flags. +The :c:member:`ml_flags` field is a bitfield which can include the following flags. The individual flags indicate either a calling convention or a binding convention.