PEP 433: add command line option and environment variable

This commit is contained in:
Victor Stinner 2013-01-25 23:07:44 +01:00
parent 039fc5d9da
commit c4b34e2827
1 changed files with 8 additions and 8 deletions

View File

@ -329,20 +329,20 @@ the whole application including all modules and the Python standard
library. This alternative is based on the `Proposal`_ and adds extra library. This alternative is based on the `Proposal`_ and adds extra
changes. changes.
Add new functions: New functions, command line argument and environment variable:
* ``sys.getdefaultcloexec() -> bool``: get the default value of the * ``sys.getdefaultcloexec() -> bool``: get the default value of the
close-on-exec flag for new file descriptor *cloexec* parameter
* ``sys.setdefaultcloexec(cloexec: bool)``: enable or disable * ``sys.setdefaultcloexec()``, ``-e`` command line option, ``PYTHONCLOEXEC``
close-on-exec flag, the state of the flag can be overriden in each environment variable (if set): set the default value of the *cloexec*
function creating a file descriptor parameter to ``True``
The major change is that the default value of the ``cloexec`` parameter The major change is that the default value of the ``cloexec`` parameter
is ``sys.getdefaultcloexec()``, instead of ``False``. is ``sys.getdefaultcloexec()``, instead of ``False``.
When ``sys.setdefaultcloexec(True)`` is called to set close-on-exec by When ``sys.setdefaultcloexec()`` is called to set close-on-exec by default, we
default, we have the same drawbacks as the have the same drawbacks as the `Enable file descriptor inheritance by default`_
`Enable file descriptor inheritance by default`_ alternative. alternative.
There are additionnal drawbacks of having two behaviours depending on There are additionnal drawbacks of having two behaviours depending on
``sys.getdefaultcloexec()`` value: ``sys.getdefaultcloexec()`` value: