Skip to content

Commit

Permalink
[3.11] 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.
(cherry picked from commit df59401)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
serhiy-storchaka committed Mar 5, 2024
1 parent f187da5 commit 9508a67
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 @@ -570,21 +570,21 @@ Accessing attributes of extension types
+-------------+------------------+-----------------------------------+
| doc | const char \* | optional docstring |
+-------------+------------------+-----------------------------------+
| closure | void \* | optional function pointer, |
| closure | void \* | optional user data 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``)::
instance) and a user data pointer (the associated ``closure``)::
typedef PyObject *(*getter)(PyObject *, void *);
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``)::
the value to be set) and a user data pointer (the associated ``closure``)::
typedef int (*setter)(PyObject *, PyObject *, void *);
Expand Down

0 comments on commit 9508a67

Please sign in to comment.