Skip to content

Commit 51d9068

Browse files
hugovkencukou
andauthored
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>
1 parent 8744ecf commit 51d9068

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Doc/c-api/structures.rst

+10-9
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,11 @@ The following flags can be used with :c:member:`PyMemberDef.flags`:
551551
from ``PyObject``.
552552
553553
Can only be used as part of :c:member:`Py_tp_members <PyTypeObject.tp_members>`
554-
:c:type:`slot <PyTypeSlot>` when creating a class using negative
554+
:c:type:`slot <PyType_Slot>` when creating a class using negative
555555
:c:member:`~PyType_Spec.basicsize`.
556556
It is mandatory in that case.
557557
558-
This flag is only used in :c:type:`PyTypeSlot`.
558+
This flag is only used in :c:type:`PyType_Slot`.
559559
When setting :c:member:`~PyTypeObject.tp_members` during
560560
class creation, Python clears it and sets
561561
:c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct.
@@ -693,7 +693,8 @@ Defining Getters and Setters
693693
694694
.. c:member:: setter set
695695
696-
Optional C function to set or delete the attribute, if omitted the attribute is readonly.
696+
Optional C function to set or delete the attribute.
697+
If ``NULL``, the attribute is read-only.
697698
698699
.. c:member:: const char* doc
699700
@@ -703,18 +704,18 @@ Defining Getters and Setters
703704
704705
Optional function pointer, providing additional data for getter and setter.
705706
706-
The ``get`` function takes one :c:expr:`PyObject*` parameter (the
707-
instance) and a function pointer (the associated ``closure``)::
707+
.. c:type:: PyObject *(*getter)(PyObject *, void *)
708708
709-
typedef PyObject *(*getter)(PyObject *, void *);
709+
The ``get`` function takes one :c:expr:`PyObject*` parameter (the
710+
instance) and a function pointer (the associated ``closure``):
710711
711712
It should return a new reference on success or ``NULL`` with a set exception
712713
on failure.
713714
714-
``set`` functions take two :c:expr:`PyObject*` parameters (the instance and
715-
the value to be set) and a function pointer (the associated ``closure``)::
715+
.. c:type:: int (*setter)(PyObject *, PyObject *, void *)
716716
717-
typedef int (*setter)(PyObject *, PyObject *, void *);
717+
``set`` functions take two :c:expr:`PyObject*` parameters (the instance and
718+
the value to be set) and a function pointer (the associated ``closure``):
718719
719720
In case the attribute should be deleted the second parameter is ``NULL``.
720721
Should return ``0`` on success or ``-1`` with a set exception on failure.

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Doc/c-api/memoryview.rst
1414
Doc/c-api/module.rst
1515
Doc/c-api/object.rst
1616
Doc/c-api/stable.rst
17-
Doc/c-api/structures.rst
1817
Doc/c-api/sys.rst
1918
Doc/c-api/type.rst
2019
Doc/c-api/typeobj.rst

0 commit comments

Comments
 (0)