Skip to content

[3.13] gh-135755: Docs: C API: Document missing PyFunction_GET* macros (GH-135762) #135917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Doc/c-api/function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ There are a few functions specific to Python functions.
.. versionadded:: 3.12
.. c:function:: PyObject* PyFunction_GetKwDefaults(PyObject *op)
Return the keyword-only argument default values of the function object *op*. This can be a
dictionary of arguments or ``NULL``.
.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)
Return the closure associated with the function object *op*. This can be ``NULL``
Expand Down Expand Up @@ -123,6 +130,19 @@ There are a few functions specific to Python functions.
Raises :exc:`SystemError` and returns ``-1`` on failure.
.. c:function:: PyObject *PyFunction_GET_CODE(PyObject *op)
PyObject *PyFunction_GET_GLOBALS(PyObject *op)
PyObject *PyFunction_GET_MODULE(PyObject *op)
PyObject *PyFunction_GET_DEFAULTS(PyObject *op)
PyObject *PyFunction_GET_KW_DEFAULTS(PyObject *op)
PyObject *PyFunction_GET_CLOSURE(PyObject *op)
PyObject *PyFunction_GET_ANNOTATIONS(PyObject *op)
These functions are similar to their ``PyFunction_Get*`` counterparts, but
do not do type checking. Passing anything other than an instance of
:c:data:`PyFunction_Type` is undefined behavior.
.. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback)
Register *callback* as a function watcher for the current interpreter.
Expand Down
24 changes: 24 additions & 0 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -965,21 +965,45 @@ PyFunction_Check:PyObject*:o:0:
PyFunction_GetAnnotations:PyObject*::0:
PyFunction_GetAnnotations:PyObject*:op:0:

PyFunction_GET_ANNOTATIONS:PyObject*::0:
PyFunction_GET_ANNOTATIONS:PyObject*:op:0:

PyFunction_GetClosure:PyObject*::0:
PyFunction_GetClosure:PyObject*:op:0:

PyFunction_GET_CLOSURE:PyObject*::0:
PyFunction_GET_CLOSURE:PyObject*:op:0:

PyFunction_GetCode:PyObject*::0:
PyFunction_GetCode:PyObject*:op:0:

PyFunction_GET_CODE:PyObject*::0:
PyFunction_GET_CODE:PyObject*:op:0:

PyFunction_GetDefaults:PyObject*::0:
PyFunction_GetDefaults:PyObject*:op:0:

PyFunction_GET_DEFAULTS:PyObject*::0:
PyFunction_GET_DEFAULTS:PyObject*:op:0:

PyFunction_GetKwDefaults:PyObject*::0:
PyFunction_GetKwDefaults:PyObject*:op:0:

PyFunction_GET_KW_DEFAULTS:PyObject*::0:
PyFunction_GET_KW_DEFAULTS:PyObject*:op:0:

PyFunction_GetGlobals:PyObject*::0:
PyFunction_GetGlobals:PyObject*:op:0:

PyFunction_GET_GLOBALS:PyObject*::0:
PyFunction_GET_GLOBALS:PyObject*:op:0:

PyFunction_GetModule:PyObject*::0:
PyFunction_GetModule:PyObject*:op:0:

PyFunction_GET_MODULE:PyObject*::0:
PyFunction_GET_MODULE:PyObject*:op:0:

PyFunction_New:PyObject*::+1:
PyFunction_New:PyObject*:code:+1:
PyFunction_New:PyObject*:globals:+1:
Expand Down
Loading