8000 [3.13] gh-135755: Docs: C API: Document missing `PyFunction_GET*` mac… · python/cpython@c344aad · GitHub
[go: up one dir, main page]

Skip to content

Commit c344aad

Browse files
miss-islingtonZeroIntensitybrianschubertencukou
authored
[3.13] gh-135755: Docs: C API: Document missing PyFunction_GET* macros (GH-135762) (GH-135917)
(cherry picked from commit ca87a47) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Brian Schubert <brianm.schubert@gmail.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 3e43628 commit c344aad

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

Doc/c-api/function.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ There are a few functions specific to Python functions.
9595
9696
.. versionadded:: 3.12
9797
98+
99+
.. c:function:: PyObject* PyFunction_GetKwDefaults(PyObject *op)
100+
101+
Return the keyword-only argument default values of the function object *op*. This can be a
102+
dictionary of arguments or ``NULL``.
103+
104+
98105
.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)
99106
100107
Return the closure associated with the function object *op*. This can be ``NULL``
@@ -123,6 +130,19 @@ There are a few functions specific to Python functions.
123130
Raises :exc:`SystemError` and returns ``-1`` on failure.
124131
125132
133+
.. c:function:: PyObject *PyFunction_GET_CODE(PyObject *op)
134+
PyObject *PyFunction_GET_GLOBALS(PyObject *op)
135+
PyObject *PyFunction_GET_MODULE(PyObject *op)
136+
PyObject *PyFunction_GET_DEFAULTS(PyObject *op)
137+
PyObject *PyFunction_GET_KW_DEFAULTS(PyObject *op)
138+
PyObject *PyFunction_GET_CLOSURE(PyObject *op)
139+
PyObject *PyFunction_GET_ANNOTATIONS(PyObject *op)
140+
141+
These functions are similar to their ``PyFunction_Get*`` counterparts, but
142+
do not do type checking. Passing anything other than an instance of
143+
:c:data:`PyFunction_Type` is undefined behavior.
144+
145+
126146
.. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback)
127147
128148
Register *callback* as a function watcher for the current interpreter.

Doc/data/refcounts.dat

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,21 +965,45 @@ PyFunction_Check:PyObject*:o:0:
965965
PyFunction_GetAnnotations:PyObject*::0:
966966
PyFunction_GetAnnotations:PyObject*:op:0:
967967

968+
PyFunction_GET_ANNOTATIONS:PyObject*::0:
969+
PyFunction_GET_ANNOTATIONS:PyObject*:op:0:
970+
968971
PyFunction_GetClosure:PyObject*::0:
969972
PyFunction_GetClosure:PyObject*:op:0:
970973

974+
PyFunction_GET_CLOSURE:PyObject*::0:
975+
PyFunction_GET_CLOSURE:PyObject*:op:0:
976+
971977
PyFunction_GetCode:PyObject*::0:
972978
PyFunction_GetCode:PyObject*:op:0:
973979

980+
PyFunction_GET_CODE:PyObject*::0:
981+
PyFunction_GET_CODE:PyObject*:op:0:
982+
974983
PyFunction_GetDefaults:PyObject*::0:
975984
PyFunction_GetDefaults:PyObject*:op:0:
976985

986+
PyFunction_GET_DEFAULTS:PyObject*::0:
987+
PyFunction_GET_DEFAULTS:PyObject*:op:0:
988+
989+
PyFunction_GetKwDefaults:PyObject*::0:
990+
PyFunction_GetKwDefaults:PyObject*:op:0:
991+
992+
PyFunction_GET_KW_DEFAULTS:PyObject*::0:
993+
PyFunction_GET_KW_DEFAULTS:PyObject*:op:0:
994+
977995
PyFunction_GetGlobals:PyObject*::0:
978996
PyFunction_GetGlobals:PyObject*:op:0:
979997

998+
PyFunction_GET_GLOBALS:PyObject*::0:
999+
PyFunction_GET_GLOBALS:PyObject*:op:0:
1000+
9801001
PyFunction_GetModule:PyObject*::0:
9811002
PyFunction_GetModule:PyObject*:op:0:
9821003

1004+
PyFunction_GET_MODULE:PyObject*::0:
1005+
PyFunction_GET_MODULE:PyObject*:op:0:
1006+
9831007
PyFunction_New:PyObject*::+1:
9841008
PyFunction_New:PyObject*:code:+1:
9851009
PyFunction_New:PyObject*:globals:+1:

0 commit comments

Comments
 (0)
0