]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] Clarify the docs for `args` in asyncio callbacks (GH-143873) (#144664)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 10 Feb 2026 13:16:12 +0000 (14:16 +0100)
committerGitHub <noreply@github.com>
Tue, 10 Feb 2026 13:16:12 +0000 (13:16 +0000)
Clarify the docs for `args` in asyncio callbacks (GH-143873)
(cherry picked from commit 40a82abe9335e78e34ca564243499490e50b8888)

Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Doc/library/asyncio-eventloop.rst

index bb423d3aaa9e7a4d052165ad5971f6e7c0c348da..fa100c256e99e76b1bc7f248e89d00bdc5ab0285 100644 (file)
@@ -291,8 +291,9 @@ clocks to track time.
    are called is undefined.
 
    The optional positional *args* will be passed to the callback when
-   it is called. If you want the callback to be called with keyword
-   arguments use :func:`functools.partial`.
+   it is called. Use :func:`functools.partial`
+   :ref:`to pass keyword arguments <asyncio-pass-keywords>` to
+   *callback*.
 
    An optional keyword-only *context* argument allows specifying a
    custom :class:`contextvars.Context` for the *callback* to run in.
@@ -1018,8 +1019,8 @@ Watching file descriptors
 .. method:: loop.add_writer(fd, callback, *args)
 
    Start monitoring the *fd* file descriptor for write availability and
-   invoke *callback* with the specified arguments once *fd* is available for
-   writing.
+   invoke *callback* with the specified arguments *args* once *fd* is
+   available for writing.
 
    Any preexisting callback registered for *fd* is cancelled and replaced by
    *callback*.
@@ -1292,7 +1293,8 @@ Unix signals
 
 .. method:: loop.add_signal_handler(signum, callback, *args)
 
-   Set *callback* as the handler for the *signum* signal.
+   Set *callback* as the handler for the *signum* signal,
+   passing *args* as positional arguments.
 
    The callback will be invoked by *loop*, along with other queued callbacks
    and runnable coroutines of that event loop. Unlike signal handlers
@@ -1327,7 +1329,8 @@ Executing code in thread or process pools
 
 .. awaitablemethod:: loop.run_in_executor(executor, func, *args)
 
-   Arrange for *func* to be called in the specified executor.
+   Arrange for *func* to be called in the specified executor
+   passing *args* as positional arguments.
 
    The *executor* argument should be an :class:`concurrent.futures.Executor`
    instance. The default executor is used if *executor* is ``None``.