mirror of
https://github.com/python/cpython.git
synced 2025-08-26 19:55:24 +00:00
bpo-35537: subprocess uses os.posix_spawn in some cases (GH-11452)
The subprocess module can now use the os.posix_spawn() function in some cases for better performance. Currently, it is only used on macOS and Linux (using glibc 2.24 or newer) if all these conditions are met: * executable path contains a directory * close_fds=False * preexec_fn, pass_fds, cwd, stdin, stdout, stderr and start_new_session parameters are not set Co-authored-by: Joannah Nanjekye <nanjekyejoannah@gmail.com>
This commit is contained in:
parent
a37f52436f
commit
9daecf37a5
4 changed files with 99 additions and 0 deletions
|
@ -610,6 +610,11 @@ def collect_get_config(info_add):
|
|||
info_add('%s[%s]' % (prefix, key), repr(config[key]))
|
||||
|
||||
|
||||
def collect_subprocess(info_add):
|
||||
import subprocess
|
||||
copy_attributes(info_add, subprocess, 'subprocess.%s', ('_USE_POSIX_SPAWN',))
|
||||
|
||||
|
||||
def collect_info(info):
|
||||
error = False
|
||||
info_add = info.add
|
||||
|
@ -639,6 +644,7 @@ def collect_info(info):
|
|||
collect_cc,
|
||||
collect_gdbm,
|
||||
collect_get_config,
|
||||
collect_subprocess,
|
||||
|
||||
# Collecting from tests should be last as they have side effects.
|
||||
collect_test_socket,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue