diff options
author | ram vikram singh <ramvikrams243@gmail.com> | 2022-12-17 07:12:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-17 07:12:39 (GMT) |
commit | 8edcb30c3f8bdd8099a093146fedbd9b63a3f667 (patch) | |
tree | 4d5176bc5edf5a5e80ef67a7301edaae4bddd87e /Doc | |
parent | a6f82f1fc68cb24e2d88d35fde4cfb663213a744 (diff) | |
download | cpython-8edcb30c3f8bdd8099a093146fedbd9b63a3f667.zip cpython-8edcb30c3f8bdd8099a093146fedbd9b63a3f667.tar.gz cpython-8edcb30c3f8bdd8099a093146fedbd9b63a3f667.tar.bz2 |
gh-97909: Fix markup for `PyMethodDef` members (#100089)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/c-api/structures.rst | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 827d624..be6e7b5 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -228,29 +228,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 | - +------------------+---------------+-------------------------------+ - -The :attr:`ml_meth` is a C function pointer. The functions may be of different + .. 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 :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. |