Skip to content

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

Merged
vstinner merged 2 commits intopython:mainfrom
devnexen:fcntl_module_fbsd_update
Dec 8, 2021
Merged

bpo-46016: fcntl module add FreeBSD's F_DUP2FD_CLOEXEC flag support.#29993
vstinner merged 2 commits intopython:mainfrom
devnexen:fcntl_module_fbsd_update

Conversation

@devnexen
Copy link
Copy Markdown
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
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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