diff options
author | Gregory P. Smith <gps@python.org> | 2023-05-25 20:14:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-25 20:14:09 (GMT) |
commit | d08679212d9af52dd074cd4a6abb440edb944c9c (patch) | |
tree | dc021738afae652454a1dfeb14ddf0d8ba6a82b5 /Doc | |
parent | 08888650aa03e285a97f84f34c2629ec8a8a8681 (diff) | |
download | cpython-d08679212d9af52dd074cd4a6abb440edb944c9c.zip cpython-d08679212d9af52dd074cd4a6abb440edb944c9c.tar.gz cpython-d08679212d9af52dd074cd4a6abb440edb944c9c.tar.bz2 |
gh-104372: Drop the GIL around the vfork() call. (#104782)
On Linux where the `subprocess` module can use the `vfork` syscall for
faster spawning, prevent the parent process from blocking other threads
by dropping the GIL while it waits for the vfork'ed child process `exec`
outcome. This prevents spawning a binary from a slow filesystem from
blocking the rest of the application.
Fixes #104372.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/subprocess.rst | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index 53dfbf8..738e611 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -57,10 +57,13 @@ underlying :class:`Popen` interface can be used directly. and combine both streams into one, use ``stdout=PIPE`` and ``stderr=STDOUT`` instead of *capture_output*. - The *timeout* argument is passed to :meth:`Popen.communicate`. If the timeout - expires, the child process will be killed and waited for. The - :exc:`TimeoutExpired` exception will be re-raised after the child process - has terminated. + A *timeout* may be specified in seconds, it is internally passed on to + :meth:`Popen.communicate`. If the timeout expires, the child process will be + killed and waited for. The :exc:`TimeoutExpired` exception will be + re-raised after the child process has terminated. The initial process + creation itself cannot be interrupted on many platform APIs so you are not + guaranteed to see a timeout exception until at least after however long + process creation takes. The *input* argument is passed to :meth:`Popen.communicate` and thus to the subprocess's stdin. If used it must be a byte sequence, or a string if @@ -734,7 +737,7 @@ arguments. code. All of the functions and methods that accept a *timeout* parameter, such as -:func:`call` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` if +:func:`run` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` if the timeout expires before the process exits. Exceptions defined in this module all inherit from :exc:`SubprocessError`. |