@@ -551,11 +551,11 @@ The following flags can be used with :c:member:`PyMemberDef.flags`:
551
551
from ``PyObject ``.
552
552
553
553
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
555
555
:c:member: `~PyType_Spec.basicsize `.
556
556
It is mandatory in that case.
557
557
558
- This flag is only used in :c:type: `PyTypeSlot `.
558
+ This flag is only used in :c:type: `PyType_Slot `.
559
559
When setting :c:member: `~PyTypeObject.tp_members ` during
560
560
class creation, Python clears it and sets
561
561
:c:member: `PyMemberDef.offset ` to the offset from the ``PyObject `` struct.
@@ -693,7 +693,8 @@ Defining Getters and Setters
693
693
694
694
.. c:member:: setter set
695
695
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.
697
698
698
699
.. c:member:: const char* doc
699
700
@@ -703,18 +704,18 @@ Defining Getters and Setters
703
704
704
705
Optional function pointer, providing additional data for getter and setter.
705
706
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 *)
708
708
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 ``):
710
711
711
712
It should return a new reference on success or ``NULL`` with a set exception
712
713
on failure.
713
714
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 *)
716
716
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 ``):
718
719
719
720
In case the attribute should be deleted the second parameter is ``NULL``.
720
721
Should return ``0`` on success or ``-1`` with a set exception on failure.
0 commit comments