[docs] [issue27150] PEP446 (CLOEXEC by default) violation with fcntl.fcntl(..., fcntl.F_DUPFD)

Martin Panter report at bugs.python.org
Sun May 29 04:10:27 EDT 2016


Martin Panter added the comment:

I don’t see any violation or anything needing fixing in the documentation or code. Can you elaborate?

The fcntl() documentation says “The values used for ‘cmd’ [F_DUPFD, etc] are operating system dependent, and are available as constants in the ‘fcntl’ module, using the same names as used in the relevant C header files.” The newest version of Posix specifies both the F_DUPFD and F_DUPFD_CLOEXEC. It would be misleading for Python to use one when the user specified the other.

If you want a best-effort version of F_DUPFD_CLOEXEC for a single-threaded program, why not use os.dup()? I presume this uses F_DUPFD_CLOEXEC where appropriate, and uses some non-atomic fallback if necessary.

----------
nosy: +haypo, martin.panter

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27150>
_______________________________________


More information about the docs mailing list