gh-121381 Remove subprocess._USE_VFORK escape hatch (#121383)

This flag was added as an escape hatch in gh-91401 and backported to
Python 3.10. The flag broke at some point between its addition and now.
As there is currently no publicly known environments that require this,
remove it rather than work on fixing it.

This leaves the flag in the subprocess module to not break code which
may have used / checked the flag itself.

discussion: https://discuss.python.org/t/subprocess-use-vfork-escape-hatch-broken-fix-or-remove/56915/2
This commit is contained in:
Cody Maloney 2024-07-30 18:39:54 -07:00 committed by GitHub
parent 82db572813
commit a9344cdffa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 21 additions and 62 deletions

View file

@ -977,7 +977,6 @@ _posixsubprocess.fork_exec as subprocess_fork_exec
uid as uid_object: object
child_umask: int
preexec_fn: object
allow_vfork: bool
/
Spawn a fresh new child process.
@ -1014,8 +1013,8 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
pid_t pgid_to_set, PyObject *gid_object,
PyObject *extra_groups_packed,
PyObject *uid_object, int child_umask,
PyObject *preexec_fn, int allow_vfork)
/*[clinic end generated code: output=7ee4f6ee5cf22b5b input=51757287ef266ffa]*/
PyObject *preexec_fn)
/*[clinic end generated code: output=288464dc56e373c7 input=f311c3bcb5dd55c8]*/
{
PyObject *converted_args = NULL, *fast_args = NULL;
PyObject *preexec_fn_args_tuple = NULL;
@ -1218,7 +1217,7 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
#ifdef VFORK_USABLE
/* Use vfork() only if it's safe. See the comment above child_exec(). */
sigset_t old_sigs;
if (preexec_fn == Py_None && allow_vfork &&
if (preexec_fn == Py_None &&
uid == (uid_t)-1 && gid == (gid_t)-1 && extra_group_size < 0) {
/* Block all signals to ensure that no signal handlers are run in the
* child process while it shares memory with us. Note that signals