From 199c41440bdf0d765cddf59c9ff7a8009736d005 Mon Sep 17 00:00:00 2001 From: Johnny11502 <113304663+Johnny11502@users.noreply.github.com> Date: Wed, 19 Oct 2022 21:56:45 -0400 Subject: [PATCH 1/4] Updated the members of PyMemberDef --- Doc/c-api/structures.rst | 42 +++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 76803a093353b5..e97f2ac1696fe7 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -406,27 +406,25 @@ 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 | - +------------------+---------------+-------------------------------+ - - :attr:`!type` can be one of many ``T_`` macros corresponding to various C + .. c:member:: const char* PyMemberDef.name + .. 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. + + + :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. @@ -460,7 +458,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` From acdc0bc7426a8aff002f12486f18d525a882172d Mon Sep 17 00:00:00 2001 From: Johnny11502 <113304663+Johnny11502@users.noreply.github.com> Date: Wed, 19 Oct 2022 22:32:56 -0400 Subject: [PATCH 2/4] Updated members of PyMemberDef --- Doc/c-api/structures.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index e97f2ac1696fe7..f061f96b6f366a 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -408,21 +408,20 @@ Accessing attributes of extension types .. c:member:: const char* PyMemberDef.name .. 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. - :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 From 474b2a07d803d40d6604f9f219e085835ac4c723 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 24 Oct 2022 15:46:17 +0200 Subject: [PATCH 3/4] Add doc for PyMemberDef.name Co-authored-by: T --- Doc/c-api/structures.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index f061f96b6f366a..9700567bf5a3cd 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -407,6 +407,9 @@ Accessing attributes of extension types struct member. Its fields are: .. c:member:: const char* PyMemberDef.name + + Name of the member + .. c:member:: int PyMemberDef.type The type of the member in the C struct. From 3d4b2f42f2861934fcdf2bd3c1498bc80f894523 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 24 Oct 2022 15:52:43 +0200 Subject: [PATCH 4/4] Remove trailing whitespace from the suggestion --- Doc/c-api/structures.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst index 9700567bf5a3cd..a6eb9fad816df3 100644 --- a/Doc/c-api/structures.rst +++ b/Doc/c-api/structures.rst @@ -407,9 +407,9 @@ Accessing attributes of extension types struct member. Its fields are: .. c:member:: const char* PyMemberDef.name - + Name of the member - + .. c:member:: int PyMemberDef.type The type of the member in the C struct.