Skip to content

Commit b64e42b

Browse files
committed
Update Doc/library/subprocess.rst
1 parent 43b500f commit b64e42b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Doc/library/subprocess.rst

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,14 +803,24 @@ Instances of the :class:`Popen` class have the following methods:
803803

804804
.. note::
805805

806-
When the ``timeout`` parameter is not ``None``, then (on POSIX) the
807-
function is implemented using a busy loop (non-blocking call and short
808-
sleeps). Use the :mod:`asyncio` module for an asynchronous wait: see
806+
When ``timeout`` is not ``None``, an efficient event-driven mechanism
807+
waits for process termination when available:
808+
809+
- Linux ≥5.3 uses :func:`os.pidfd_open` + :func:`select.poll`
810+
- macOS and other BSD variants use :func:`select.kqueue`
811+
- Windows uses ``WaitForSingleObject``
812+
813+
If none of these mechanisms are available, the function falls back to a
814+
busy loop (non-blocking call and short sleeps). Use the :mod:`asyncio`
815+
module for an asynchronous wait: see
809816
:class:`asyncio.create_subprocess_exec`.
810817

811818
.. versionchanged:: 3.3
812819
*timeout* was added.
813820

821+
.. versionchanged:: 3.15
822+
use efficient event-driven implementation on Linux >= 5.3 and macOS / BSD.
823+
814824
.. method:: Popen.communicate(input=None, timeout=None)
815825

816826
Interact with process: Send data to stdin. Read data from stdout and stderr,

0 commit comments

Comments
 (0)