diff options
author | Gregory P. Smith <greg@krypto.org> | 2022-04-25 23:19:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 23:19:39 (GMT) |
commit | cd5726fe674eaff442510eeb6c75628858be9e9f (patch) | |
tree | d311f0b144298e29596d1fb5dcc4629ec9e8647e /Lib/multiprocessing | |
parent | eddd07f840c9a4ab0ee05ce56d98caac0f072cef (diff) | |
download | cpython-cd5726fe674eaff442510eeb6c75628858be9e9f.zip cpython-cd5726fe674eaff442510eeb6c75628858be9e9f.tar.gz cpython-cd5726fe674eaff442510eeb6c75628858be9e9f.tar.bz2 |
gh-91401: Add a failsafe way to disable vfork. (#91490)
Just in case there is ever an issue with _posixsubprocess's use of
vfork() due to the complexity of using it properly and potential
directions that Linux platforms where it defaults to on could take, this
adds a failsafe so that users can disable its use entirely by setting
a global flag.
No known reason to disable it exists. But it'd be a shame to encounter
one and not be able to use CPython without patching and rebuilding it.
See the linked issue for some discussion on reasoning.
Also documents the existing way to disable posix_spawn.
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/util.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/multiprocessing/util.py b/Lib/multiprocessing/util.py index abbc4c5..790955e 100644 --- a/Lib/multiprocessing/util.py +++ b/Lib/multiprocessing/util.py @@ -446,13 +446,15 @@ def _flush_std_streams(): def spawnv_passfds(path, args, passfds): import _posixsubprocess + import subprocess passfds = tuple(sorted(map(int, passfds))) errpipe_read, errpipe_write = os.pipe() try: return _posixsubprocess.fork_exec( args, [path], True, passfds, None, None, -1, -1, -1, -1, -1, -1, errpipe_read, errpipe_write, - False, False, None, None, None, -1, None) + False, False, None, None, None, -1, None, + subprocess._USE_VFORK) finally: os.close(errpipe_read) os.close(errpipe_write) |