summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>2024-01-24 13:40:09 (GMT)
committerGitHub <noreply@github.com>2024-01-24 13:40:09 (GMT)
commit51d9068ede41d49e86c9637960f212e2a0f07f4c (patch)
treedaa51af234e8e79d3b2b6291a3d55a3a4e08d3e3
parent8744ecf5896ccf57875574a9aed46369b8d48dc1 (diff)
downloadcpython-51d9068ede41d49e86c9637960f212e2a0f07f4c.zip
cpython-51d9068ede41d49e86c9637960f212e2a0f07f4c.tar.gz
cpython-51d9068ede41d49e86c9637960f212e2a0f07f4c.tar.bz2
gh-101100: Fix Sphinx warnings in `c-api/structures.rst` (#113564)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
-rw-r--r--Doc/c-api/structures.rst19
-rw-r--r--Doc/tools/.nitignore1
2 files changed, 10 insertions, 10 deletions
diff --git a/Doc/c-api/structures.rst b/Doc/c-api/structures.rst
index 86c7794..0032da9 100644
--- a/Doc/c-api/structures.rst
+++ b/Doc/c-api/structures.rst
@@ -551,11 +551,11 @@ The following flags can be used with :c:member:`PyMemberDef.flags`:
from ``PyObject``.
Can only be used as part of :c:member:`Py_tp_members <PyTypeObject.tp_members>`
- :c:type:`slot <PyTypeSlot>` when creating a class using negative
+ :c:type:`slot <PyType_Slot>` when creating a class using negative
:c:member:`~PyType_Spec.basicsize`.
It is mandatory in that case.
- This flag is only used in :c:type:`PyTypeSlot`.
+ This flag is only used in :c:type:`PyType_Slot`.
When setting :c:member:`~PyTypeObject.tp_members` during
class creation, Python clears it and sets
:c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct.
@@ -693,7 +693,8 @@ Defining Getters and Setters
.. c:member:: setter set
- Optional C function to set or delete the attribute, if omitted the attribute is readonly.
+ Optional C function to set or delete the attribute.
+ If ``NULL``, the attribute is read-only.
.. c:member:: const char* doc
@@ -703,18 +704,18 @@ Defining Getters and Setters
Optional function pointer, providing additional data for getter and setter.
- The ``get`` function takes one :c:expr:`PyObject*` parameter (the
- instance) and a function pointer (the associated ``closure``)::
+.. c:type:: PyObject *(*getter)(PyObject *, void *)
- typedef PyObject *(*getter)(PyObject *, void *);
+ The ``get`` function takes one :c:expr:`PyObject*` parameter (the
+ instance) and a function pointer (the associated ``closure``):
It should return a new reference on success or ``NULL`` with a set exception
on failure.
- ``set`` functions take two :c:expr:`PyObject*` parameters (the instance and
- the value to be set) and a function pointer (the associated ``closure``)::
+.. c:type:: int (*setter)(PyObject *, PyObject *, void *)
- typedef int (*setter)(PyObject *, PyObject *, void *);
+ ``set`` functions take two :c:expr:`PyObject*` parameters (the instance and
+ the value to be set) and a function pointer (the associated ``closure``):
In case the attribute should be deleted the second parameter is ``NULL``.
Should return ``0`` on success or ``-1`` with a set exception on failure.
diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore
index 6778e57..00b4b69 100644
--- a/Doc/tools/.nitignore
+++ b/Doc/tools/.nitignore
@@ -14,7 +14,6 @@ Doc/c-api/memoryview.rst
Doc/c-api/module.rst
Doc/c-api/object.rst
Doc/c-api/stable.rst
-Doc/c-api/structures.rst
Doc/c-api/sys.rst
Doc/c-api/type.rst
Doc/c-api/typeobj.rst