Gregory P. Smith <g...@krypto.org> added the comment:

Note that vfork() support has been merged for 3.10 via bpo-35823, so 
posix_spawn() is less of a performance carrot than it used to be on Linux.  
vfork() exists macOS, that code could likely be enabled there after some 
investigation+testing.

Regardless, changing this default sounds difficult due to the variety of things 
depending on the existing behavior - potentially for security issues as you've 
noted - when running in a process with other file descriptors potentially not 
managed by Python (ie: extension modules) that don't explicitly use CLOEXEC.

The subprocess APIs are effectively evolving to become lower level over time as 
we continually find warts in them that need addressing but find defaults that 
cannot change due to existing uses.  A higher level "best practices for 
launching child processes module" with APIs reflecting explicit intents 
(performance vs security vs simplicity) rather than requiring users to 
understand subprocess platform specific details may be a good idea at this 
point (on PyPI I assume).

We changed posix close_fds default to True in 3.2 when Jeffrey and I wrote 
_posixsubprocess to better match the behavior most users actually want - 
undoing that doesn't feel right.

----------
type:  -> performance

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42738>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to