From e4698e15ee123378bd6114f44a404106546cab34 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Sun, 9 Nov 2025 10:45:52 -0500 Subject: [PATCH 1/2] Document PyFunction_SetKwDefaults(). --- Doc/c-api/function.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Doc/c-api/function.rst b/Doc/c-api/function.rst index 0bac638957155e..150fa7cdc2c191 100644 --- a/Doc/c-api/function.rst +++ b/Doc/c-api/function.rst @@ -102,6 +102,12 @@ There are a few functions specific to Python functions. dictionary of arguments or ``NULL``. +.. c:function:: PyObject* PyFunction_SetKwDefaults(PyObject *op, PyObject *defaults) + + Set the keyword-only argument default values of the function object *op*. + *defaults* must be a dictionary of keyword-only arguments or ``Py_None``. + + .. c:function:: PyObject* PyFunction_GetClosure(PyObject *op) Return the closure associated with the function object *op*. This can be ``NULL`` From bdbc3045c57707ffd27e5c939f33f25fa1ab0a21 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Sun, 9 Nov 2025 12:22:02 -0500 Subject: [PATCH 2/2] This is a setter, not a getter. I'm sleepy. --- Doc/c-api/function.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Doc/c-api/function.rst b/Doc/c-api/function.rst index 150fa7cdc2c191..609b5e885b6b16 100644 --- a/Doc/c-api/function.rst +++ b/Doc/c-api/function.rst @@ -102,11 +102,14 @@ There are a few functions specific to Python functions. dictionary of arguments or ``NULL``. -.. c:function:: PyObject* PyFunction_SetKwDefaults(PyObject *op, PyObject *defaults) +.. c:function:: int PyFunction_SetKwDefaults(PyObject *op, PyObject *defaults) Set the keyword-only argument default values of the function object *op*. *defaults* must be a dictionary of keyword-only arguments or ``Py_None``. + This function returns ``0`` on success, and returns ``-1`` with an exception + set on failure. + .. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)