]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-141004: Document `PyFunction_SetKwDefaults` (GH-141294) (GH-141305)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 9 Nov 2025 17:55:02 +0000 (18:55 +0100)
committerGitHub <noreply@github.com>
Sun, 9 Nov 2025 17:55:02 +0000 (17:55 +0000)
gh-141004: Document `PyFunction_SetKwDefaults` (GH-141294)
(cherry picked from commit 18529b580b59b8d075641da6c685bef377eb0a7b)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Doc/c-api/function.rst

index 5fb8567ef8c95fbec9a7b99f208c07955ba8efa9..7908e4f8561aebebc424b72bb97198ec69582800 100644 (file)
@@ -102,6 +102,15 @@ There are a few functions specific to Python functions.
    dictionary of arguments or ``NULL``.
 
 
+.. 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)
 
    Return the closure associated with the function object *op*. This can be ``NULL``