PEP 433: subprocess clears cloexec flag of pass_fds

This commit is contained in:
Victor Stinner 2013-02-01 00:48:18 +01:00
parent 2c9f128261
commit f2ad21574e
1 changed files with 3 additions and 8 deletions

View File

@ -174,9 +174,6 @@ standard library. Third party modules not using the standard library
should be modified to conform to this PEP. The new
``os.set_cloexec()`` function can be used for example.
XXX Should ``subprocess.Popen`` clear the close-on-exec flag on file
XXX descriptors of the constructor the ``pass_fds`` parameter?
.. note::
See `Close file descriptors after fork`_ for a possible solution
for ``fork()`` without ``exec()``.
@ -229,6 +226,9 @@ The default value of the *cloexec* parameter is
Add a new command line option ``-e`` and an environment variable
``PYTHONCLOEXEC`` to the set close-on-exec flag by default.
``subprocess`` clears the close-on-exec flag of file descriptors of the
``pass_fds`` parameter.
All functions creating file descriptors in the standard library must
respect the default *cloexec* parameter (``sys.getdefaultcloexec()``).
@ -284,11 +284,6 @@ the default value of the *cloexec* parameter is ``True`` (instead of
If a file must be inherited by child processes, ``cloexec=False``
parameter can be used.
``subprocess.Popen`` constructor has an ``pass_fds`` parameter to
specify which file descriptors must be inherited. The close-on-exec
flag of these file descriptors must be changed with
``os.set_cloexec()``.
Advantages of setting close-on-exec flag by default:
* There are far more programs that are bitten by FD inheritance upon