Fix the PyGetSetDef documentation (GH-116056)
closure is not a function pointer, it is a user data pointer.
This commit is contained in:
parent
0064dfa091
commit
df59401108
@ -702,12 +702,12 @@ Defining Getters and Setters
|
|||||||
|
|
||||||
.. c:member:: void* closure
|
.. c:member:: void* closure
|
||||||
|
|
||||||
Optional function pointer, providing additional data for getter and setter.
|
Optional user data pointer, providing additional data for getter and setter.
|
||||||
|
|
||||||
.. c:type:: PyObject *(*getter)(PyObject *, void *)
|
.. c:type:: PyObject *(*getter)(PyObject *, void *)
|
||||||
|
|
||||||
The ``get`` function takes one :c:expr:`PyObject*` parameter (the
|
The ``get`` function takes one :c:expr:`PyObject*` parameter (the
|
||||||
instance) and a function pointer (the associated ``closure``):
|
instance) and a user data pointer (the associated ``closure``):
|
||||||
|
|
||||||
It should return a new reference on success or ``NULL`` with a set exception
|
It should return a new reference on success or ``NULL`` with a set exception
|
||||||
on failure.
|
on failure.
|
||||||
@ -715,7 +715,7 @@ Defining Getters and Setters
|
|||||||
.. c:type:: int (*setter)(PyObject *, PyObject *, void *)
|
.. c:type:: int (*setter)(PyObject *, PyObject *, void *)
|
||||||
|
|
||||||
``set`` functions take two :c:expr:`PyObject*` parameters (the instance and
|
``set`` functions take two :c:expr:`PyObject*` parameters (the instance and
|
||||||
the value to be set) and a function pointer (the associated ``closure``):
|
the value to be set) and a user data pointer (the associated ``closure``):
|
||||||
|
|
||||||
In case the attribute should be deleted the second parameter is ``NULL``.
|
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.
|
Should return ``0`` on success or ``-1`` with a set exception on failure.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user