diff options
author | Johnny11502 <113304663+Johnny11502@users.noreply.github.com> | 2022-10-24 14:13:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-24 14:13:38 (GMT) |
commit | c2370763793734aa6be8dbc326b70132770eaeaa (patch) | |
tree | 7391309120edfb3e02617747d7d075089ee1e3bf /Doc/c-api | |
parent | e19c2b979fab3483dc6c04774053dbbe83e769fb (diff) | |
download | cpython-c2370763793734aa6be8dbc326b70132770eaeaa.zip cpython-c2370763793734aa6be8dbc326b70132770eaeaa.tar.gz cpython-c2370763793734aa6be8dbc326b70132770eaeaa.tar.bz2 |
gh-97909: Mark up members of PyMemberDef (GH-98473)
Co-authored-by: T <tnie@tuta.io>
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/structures.rst | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index ee757e3..183ac14 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -387,27 +387,27 @@ Accessing attributes of extension types Structure which describes an attribute of a type which corresponds to a C struct member. Its fields are: - +------------------+---------------+-------------------------------+ - | Field | C Type | Meaning | - +==================+===============+===============================+ - | :attr:`name` | const char \* | name of the member | - +------------------+---------------+-------------------------------+ - | :attr:`!type` | int | the type of the member in the | - | | | C struct | - +------------------+---------------+-------------------------------+ - | :attr:`offset` | Py_ssize_t | the offset in bytes that the | - | | | member is located on the | - | | | type's object struct | - +------------------+---------------+-------------------------------+ - | :attr:`flags` | int | flag bits indicating if the | - | | | field should be read-only or | - | | | writable | - +------------------+---------------+-------------------------------+ - | :attr:`doc` | const char \* | points to the contents of the | - | | | docstring | - +------------------+---------------+-------------------------------+ + .. c:member:: const char* PyMemberDef.name + + Name of the member + + .. c:member:: int PyMemberDef.type + + The type of the member in the C struct. + + .. c:member:: Py_ssize_t PyMemberDef.offset + + The offset in bytes that the member is located on the type’s object struct. + + .. c:member:: int PyMemberDef.flags + + Flag bits indicating if the field should be read-only or writable. + + .. c:member:: const char* PyMemberDef.doc + + Points to the contents of the docstring. - :attr:`!type` can be one of many ``T_`` macros corresponding to various C + :c:member:`PyMemberDef.type` can be one of many ``T_`` macros corresponding to various C types. When the member is accessed in Python, it will be converted to the equivalent Python type. @@ -441,7 +441,7 @@ Accessing attributes of extension types handles use of the :keyword:`del` statement on that attribute more correctly than :c:macro:`T_OBJECT`. - :attr:`flags` can be ``0`` for write and read access or :c:macro:`READONLY` for + :c:member:`PyMemberDef.flags` can be ``0`` for write and read access or :c:macro:`READONLY` for read-only access. Using :c:macro:`T_STRING` for :attr:`type` implies :c:macro:`READONLY`. :c:macro:`T_STRING` data is interpreted as UTF-8. Only :c:macro:`T_OBJECT` and :c:macro:`T_OBJECT_EX` |