PEP 433: inherance => inheritance
This commit is contained in:
parent
8794e08fd7
commit
e3240efb66
22
pep-0433.txt
22
pep-0433.txt
|
@ -38,7 +38,7 @@ inherited; the file descriptor is inherited by child processes if the
|
|||
close-on-exec 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).
|
||||
Windows does now have "close-on-exec" flag but an inherance flag which
|
||||
Windows does now have "close-on-exec" flag but an inheritance flag which
|
||||
is just the opposite value. For example, setting close-on-exec flag
|
||||
means clearing the ``HANDLE_FLAG_INHERIT`` flag of an handle.
|
||||
|
||||
|
@ -235,7 +235,7 @@ Drawbacks of the proposal:
|
|||
* It is not more possible to know if the close-on-exec flag will be
|
||||
set or not on a newly created file descriptor just by reading the
|
||||
source code.
|
||||
* If the inherance of a file descriptor matters, the *cloexec*
|
||||
* If the inheritance of a file descriptor matters, the *cloexec*
|
||||
parameter must now be specified explicitly, or the library or the
|
||||
application will not work depending on the default value of the
|
||||
*cloexec* parameter.
|
||||
|
@ -244,12 +244,12 @@ Drawbacks of the proposal:
|
|||
Alternatives
|
||||
============
|
||||
|
||||
Enable inherance by default and no configurable default
|
||||
Inheritance enabled by default, default no configurable
|
||||
-------------------------------------------------------
|
||||
|
||||
Add a new optional parameter *cloexec* on functions creating file
|
||||
descriptors. The default value of the *cloexec* parameter is ``False``,
|
||||
and this default cannot be changed. No file descriptor inherance by
|
||||
and this default cannot be changed. No file descriptor inheritance by
|
||||
default is also the default on POSIX and on Windows. This alternative is
|
||||
the most convervative option.
|
||||
|
||||
|
@ -259,8 +259,8 @@ file descriptors have to be modified to set *cloexec=True* in each
|
|||
module used by an application to fix all these issues.
|
||||
|
||||
|
||||
Enable inherance by default, default can only be set to True
|
||||
------------------------------------------------------------
|
||||
Inheritance enabled by default, default can only be set to True
|
||||
---------------------------------------------------------------
|
||||
|
||||
This alternative is based on the proposal: the only difference is that
|
||||
``sys.setdefaultcloexec()`` does not take any argument, it can only be
|
||||
|
@ -286,7 +286,7 @@ Advantages of setting close-on-exec flag by default:
|
|||
|
||||
* There are far more programs that are bitten by FD inheritance upon
|
||||
exec (see `Inherited file descriptors issues`_ and `Security`_)
|
||||
than programs relying on it (see `Applications using inherance of
|
||||
than programs relying on it (see `Applications using inheritance of
|
||||
file descriptors`_).
|
||||
|
||||
Drawbacks of setting close-on-exec flag by default:
|
||||
|
@ -302,7 +302,7 @@ Drawbacks of setting close-on-exec flag by default:
|
|||
* Extra system calls, if any, may slow down Python: see
|
||||
`Performances`_.
|
||||
|
||||
Backward compatibility: only a few programs rely on inherance of file
|
||||
Backward compatibility: only a few programs rely on inheritance of file
|
||||
descriptors, and they only pass a few file descriptors, usually just
|
||||
one. These programs will fail immediatly with ``EBADF`` error, and it
|
||||
will be simple to fix them: add ``cloexec=False`` parameter or use
|
||||
|
@ -366,11 +366,11 @@ Bikeshedding on the name of the new parameter
|
|||
|
||||
|
||||
|
||||
Applications using inherance of file descriptors
|
||||
================================================
|
||||
Applications using inheritance of file descriptors
|
||||
==================================================
|
||||
|
||||
Most developers don't know that file descriptors are inherited by
|
||||
default. Most programs do not rely on inherance of file descriptors.
|
||||
default. Most programs do not rely on inheritance of file descriptors.
|
||||
For example, ``subprocess.Popen`` was changed in Python 3.2 to close
|
||||
all file descriptors greater than 2 in the child process by default.
|
||||
No user complained about this behavior change yet.
|
||||
|
|
Loading…
Reference in New Issue