diff --git a/Doc/c-api/function.rst b/Doc/c-api/function.rst index 63b78f677674e9..bd27d604b8bd70 100644 --- a/Doc/c-api/function.rst +++ b/Doc/c-api/function.rst @@ -57,11 +57,21 @@ There are a few functions specific to Python functions. Return the code object associated with the function object *op*. +.. c:function:: PyObject *PyFunction_GET_CODE(PyObject *op) + + Similar to :c:func:`PyFunction_GetCode`, but without error checking. + + .. c:function:: PyObject* PyFunction_GetGlobals(PyObject *op) Return the globals dictionary associated with the function object *op*. +.. c:function:: PyObject *PyFunction_GET_GLOBALS(PyObject *op) + + Similar to :c:func:`PyFunction_GetGlobals`, but without error checking. + + .. c:function:: PyObject* PyFunction_GetModule(PyObject *op) Return a :term:`borrowed reference` to the :attr:`~function.__module__` @@ -72,12 +82,22 @@ There are a few functions specific to Python functions. but can be set to any other object by Python code. +.. c:function:: PyObject *PyFunction_GET_MODULE(PyObject *op) + + Similar to :c:func:`PyFunction_GetModule`, but without error checking. + + .. c:function:: PyObject* PyFunction_GetDefaults(PyObject *op) Return the argument default values of the function object *op*. This can be a tuple of arguments or ``NULL``. +.. c:function:: PyObject *PyFunction_GET_DEFAULTS(PyObject *op) + + Similar to :c:func:`PyFunction_GetDefaults`, but without error checking. + + .. c:function:: int PyFunction_SetDefaults(PyObject *op, PyObject *defaults) Set the argument default values for the function object *op*. *defaults* must be @@ -95,12 +115,33 @@ 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``. + + .. versionadded:: 3.0 + + +.. c:function:: PyObject *PyFunction_GET_KW_DEFAULTS(PyObject *op) + + Similar to :c:func:`PyFunction_GetKwDefaults`, but without error checking. + + .. versionadded:: 3.0 + + .. c:function:: PyObject* PyFunction_GetClosure(PyObject *op) Return the closure associated with the function object *op*. This can be ``NULL`` or a tuple of cell objects. +.. c:function:: PyObject *PyFunction_GET_CLOSURE(PyObject *op) + + Similar to :c:func:`PyFunction_GetClosure`, but without error checking. + + .. c:function:: int PyFunction_SetClosure(PyObject *op, PyObject *closure) Set the closure associated with the function object *op*. *closure* must be @@ -114,6 +155,15 @@ There are a few functions specific to Python functions. Return the annotations of the function object *op*. This can be a mutable dictionary or ``NULL``. + .. versionadded:: 3.0 + + +.. c:function:: PyObject *PyFunction_GET_ANNOTATIONS(PyObject *op) + + Similar to :c:func:`PyFunction_GetAnnotations`, but without error checking. + + .. versionadded:: 3.0 + .. c:function:: int PyFunction_SetAnnotations(PyObject *op, PyObject *annotations) @@ -122,6 +172,8 @@ There are a few functions specific to Python functions. Raises :exc:`SystemError` and returns ``-1`` on failure. + .. versionadded:: 3.0 + .. c:function:: int PyFunction_AddWatcher(PyFunction_WatchCallback callback) diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat index 99cc823c0c3772..144c5608e07426 100644 --- a/Doc/data/refcounts.dat +++ b/Doc/data/refcounts.dat @@ -963,21 +963,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: