Skip to content

Commit 9240c44

Browse files
committed
Add documentation for missing PyFunction_GET* macros
1 parent c8c13f8 commit 9240c44

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Doc/c-api/function.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,21 @@ There are a few functions specific to Python functions.
5757
Return the code object associated with the function object *op*.
5858
5959
60+
.. c:function:: PyObject *PyFunction_GET_CODE(PyObject *op)
61+
62+
Equivalent to :c:func:`PyFunction_GetCode`, but without error checking.
63+
64+
6065
.. c:function:: PyObject* PyFunction_GetGlobals(PyObject *op)
6166
6267
Return the globals dictionary associated with the function object *op*.
6368
6469
70+
.. c:function:: PyObject *PyFunction_GET_GLOBALS(PyObject *op)
71+
72+
Equivalent to :c:func:`PyFunction_GetGlobals`, but without error checking.
73+
74+
6575
.. c:function:: PyObject* PyFunction_GetModule(PyObject *op)
6676
6777
Return a :term:`borrowed reference` to the :attr:`~function.__module__`
@@ -72,12 +82,22 @@ There are a few functions specific to Python functions.
7282
but can be set to any other object by Python code.
7383
7484
85+
.. c:function:: PyObject *PyFunction_GET_MODULE(PyObject *op)
86+
87+
Equivalent to :c:func:`PyFunction_GetModule`, but without error checking.
88+
89+
7590
.. c:function:: PyObject* PyFunction_GetDefaults(PyObject *op)
7691
7792
Return the argument default values of the function object *op*. This can be a
7893
tuple of arguments or ``NULL``.
7994
8095
96+
.. c:function:: PyObject *PyFunction_GET_DEFAULTS(PyObject *op)
97+
98+
Equivalent to :c:func:`PyFunction_GetDefaults`, but without error checking.
99+
100+
81101
.. c:function:: int PyFunction_SetDefaults(PyObject *op, PyObject *defaults)
82102
83103
Set the argument default values for the function object *op*. *defaults* must be
@@ -95,12 +115,29 @@ There are a few functions specific to Python functions.
95115
96116
.. versionadded:: 3.12
97117
118+
119+
.. c:function:: PyObject* PyFunction_GetKwDefaults(PyObject *op)
120+
121+
Return the keyword-argument default values of the function object *op*. This can be a
122+
tuple of arguments or ``NULL``.
123+
124+
125+
.. c:function:: PyObject *PyFunction_GET_KW_DEFAULTS(PyObject *op)
126+
127+
Equivalent to :c:func:`PyFunction_GetKwDefaults`, but without error checking.
128+
129+
98130
.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)
99131
100132
Return the closure associated with the function object *op*. This can be ``NULL``
101133
or a tuple of cell objects.
102134
103135
136+
.. c:function:: PyObject *PyFunction_GET_CLOSURE(PyObject *op)
137+
138+
Equivalent to :c:func:`PyFunction_GetClosure`, but without error checking.
139+
140+
104141
.. c:function:: int PyFunction_SetClosure(PyObject *op, PyObject *closure)
105142
106143
Set the closure associated with the function object *op*. *closure* must be
@@ -115,6 +152,11 @@ There are a few functions specific to Python functions.
115152
mutable dictionary or ``NULL``.
116153
117154
155+
.. c:function:: PyObject *PyFunction_GET_ANNOTATIONS(PyObject *op)
156+
157+
Equivalent to :c:func:`PyFunction_GetAnnotations`, but without error checking.
158+
159+
118160
.. c:function:: int PyFunction_SetAnnotations(PyObject *op, PyObject *annotations)
119161
120162
Set the annotations for the function object *op*. *annotations*
@@ -193,3 +235,4 @@ There are a few functions specific to Python functions.
193235
it before returning.
194236
195237
.. versionadded:: 3.12
238+

0 commit comments

Comments
 (0)