]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] [doc] Make subprocess.wait documentation more precise (GH-98700) (GH-112153)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 25 Dec 2023 18:27:06 +0000 (19:27 +0100)
committerGitHub <noreply@github.com>
Mon, 25 Dec 2023 18:27:06 +0000 (20:27 +0200)
An active loop is only used when the `timeout` parameter is used on
POSIX.

When no timeout is used, the code calls `os.waitpid` internally (which puts
the process on a sleep status). On Windows, the internal Windows API
call accepts a timeout parameter, so that is delegated to the OS.
(cherry picked from commit 81ab0e8a4add53035c87b040afda6d554cace528)

Co-authored-by: Luis Pedro Coelho <luis@luispedro.org>
Doc/library/subprocess.rst

index 7f22a5d1852a89fe1e64351b8ea89f4a025984a7..d6b892a7ed957d438c8eff41be52e8dbe2bc2b58 100644 (file)
@@ -791,9 +791,10 @@ Instances of the :class:`Popen` class have the following methods:
 
    .. note::
 
-      The function is implemented using a busy loop (non-blocking call and
-      short sleeps). Use the :mod:`asyncio` module for an asynchronous wait:
-      see :class:`asyncio.create_subprocess_exec`.
+      When the ``timeout`` parameter is not ``None``, then (on POSIX) the
+      function is implemented using a busy loop (non-blocking call and short
+      sleeps). Use the :mod:`asyncio` module for an asynchronous wait: see
+      :class:`asyncio.create_subprocess_exec`.
 
    .. versionchanged:: 3.3
       *timeout* was added.