[Python-Dev] PEP 433: Choose the default value of the new cloexec parameter
Victor Stinner
victor.stinner at gmail.com
Fri Jan 25 00:58:13 CET 2013
Hi,
The PEP 433 proposes different options to add a new cloexec parameter:
a) cloexec=False by default
b) cloexec=True by default
c) configurable default value
I tried to list in the PEP 433 advantages and drawbacks of each option.
If I recorded correctly opinions, the different options have the
following supporters:
a) cloexec=False by default
b) cloexec=True by default: Charles-François Natali
c) configurable default value: Antoine Pitrou, Nick Coghlan, Guido van Rossum
I don't know if it's enough to say that (c) is the chosen option.
--
For the name of the new parameter, I still prefer "cloexec" for the
reason given by Antoine: on UNIX, the flag has only an effect on
exec(), not on fork(). So inherited=False can be misleading on UNIX.
I updated the rationale of the PEP to describe the close-on-exec flag:
http://www.python.org/dev/peps/pep-0433/#rationale
--
FYI on Windows, cloexec=False (inherited=True) doesn't mean that the
file descriptor will be inherited. It also depends on the
bInheritHandles parameter of the CreateProcess() function. Extract of
the PEP:
"On Windows, the file descriptor is not inherited if the close-on-exec
flag is set, the file descriptor is inherited by child processes if
the flag is cleared and if CreateProcess() is called with the
bInheritHandles parameter set to TRUE (when subprocess.Popen is
created with close_fds=False for example)."
Victor
More information about the Python-Dev
mailing list