Skip to content

Commit

Permalink
Fix the PyGetSetDef documentation (pythonGH-116056)
Browse files Browse the repository at this point in the history
closure is not a function pointer, it is a user data pointer.
  • Loading branch information
serhiy-storchaka authored and adorilson committed Mar 25, 2024
1 parent da4f201 commit 75e06cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Doc/c-api/structures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,20 +702,20 @@ Defining Getters and Setters
.. 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 *)
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
on failure.
.. c:type:: 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``):
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``.
Should return ``0`` on success or ``-1`` with a set exception on failure.

0 comments on commit 75e06cd

Please sign in to comment.