Message405075
Gregory P. Smith wrote:
> 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).
Interesting that you say that. subprocess was originally written with exactly this idea in mind - to create a module which deals with all the platform details, so that the user doesn't have to know about them: https://www.python.org/dev/peps/pep-0324/#motivation
On the topic itself: I believe Python should come with safe and usable defaults, but provide ways to enable alternative approaches which have more performance if the user so decides (by e.g. passing in a parameter). In such cases, the user then becomes responsible for understanding the implications.
Since there already is a parameter, expert users can already gain more performance by using it and then explicitly only closing FDs the users knows can/should be closed in the new process.
Perhaps there's a middle ground: have subprocess only loop over the first 64k FDs per default and not all possible ones. |
|
Date |
User |
Action |
Args |
2021-10-27 08:25:28 | lemburg | set | recipients:
+ lemburg, gregory.p.smith, vstinner, eryksun, izbyshev, richardxia |
2021-10-27 08:25:28 | lemburg | set | messageid: <1635323128.62.0.934649238851.issue42738@roundup.psfhosted.org> |
2021-10-27 08:25:28 | lemburg | link | issue42738 messages |
2021-10-27 08:25:28 | lemburg | create | |
|