-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
PEP446 (CLOEXEC by default) violation with fcntl.fcntl(..., fcntl.F_DUPFD) #71337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is F_DUPFD_CLOEXEC constant, that must be used instead of F_DUPFD transparently when kernel >= 2.6.24. |
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. |
I don't think that it's possible nor worth it to wrap all fcntl() and all If you want to change something, explian in fcntl module doc that the PEP-466 is not implemented in this module znd it's a deliberate choice. I agree with Martin, it's the responsability of the dev to use the right |
OK, it will be consistent, if docs mention that F_DUPFD will not set O_CLOEXEC automatically, mentiont that F_DUPFD_CLOEXEC should be used for that, and also mention PEP-446 somewhere. |
F_DUPFD is not explicitly documented, so I do not think that we should do anything here. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: