Skip to content
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

bpo-46016: fcntl module add FreeBSD's F_DUP2FD_CLOEXEC flag support. #29993

Merged
merged 2 commits into from
Dec 8, 2021

Conversation

devnexen
Copy link
Contributor

@devnexen devnexen commented Dec 8, 2021

@devnexen devnexen changed the title fcntl module add FreeBSD's F_DUP2FD_CLOEXEC flag support. bpo-46016: fcntl module add FreeBSD's F_DUP2FD_CLOEXEC flag support. Dec 8, 2021
@@ -0,0 +1 @@
- Adding F_DUP2FD_CLOEXEC flag from FreeBSD into the fcntl module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be nice to document the constant somewhere in Doc/library/fcntl.rst:
https://docs.python.org/dev/library/fcntl.html

You can also document the new constant in What's New in Python 3.11, add a new "fcntl" section to:
https://docs.python.org/dev/whatsnew/3.11.html#improved-modules

@devnexen devnexen force-pushed the fcntl_module_fbsd_update branch from ce5ef5b to fbaeb28 Compare December 8, 2021 19:39
@ronaldoussoren
Copy link
Contributor

Similar functionality on Linux is exposed through os.dup (the inherited flag, see https://docs.python.org/3.11/library/os.html?highlight=os.dup2#os.dup2). It might be better to do the same for FreeBSD (and macOS) as well.

@tiran
Copy link
Member

tiran commented Dec 8, 2021

The bugs.python.org ticket for this PR is empty. Please update the ticket with an explanation what you are trying to archive.

@vstinner vstinner merged commit 267539b into python:main Dec 8, 2021
@vstinner
Copy link
Member

vstinner commented Dec 8, 2021

Merged, thanks. Adding 2 constants is fine.

It would be great to document properly each constant in the fcntl doc (not only these 2 constants), but it can be done in a separated PR.

os.dup2() has a fcntl(fd, F_DUP2FD_CLOEXEC, fd2) implementation. Is it used on FreeBSD?

@vstinner
Copy link
Member

vstinner commented Dec 8, 2021

Similar functionality on Linux is exposed through os.dup (the inherited flag, see https://docs.python.org/3.11/library/os.html?highlight=os.dup2#os.dup2). It might be better to do the same for FreeBSD (and macOS) as well.

F_DUP2FD / F_DUP2FD_CLOEXEC is more about os.dup2(), no? As I wrote, F_DUP2FD_CLOEXEC is already used by os.dup2() if available. I dont know if it is used on macOS. I no longer have access to a macOS machine to develop Python on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants