From 8e18a9dce2af361d9974812e6ffa22bf3970d057 Mon Sep 17 00:00:00 2001 From: "RUANG (James Roy)" Date: Fri, 25 Apr 2025 05:06:42 +0800 Subject: gh-127385: Add F_DUPFD_QUERY to fcntl (GH-127386) --- Doc/library/fcntl.rst | 4 ++++ .../next/Library/2024-11-29-13-06-52.gh-issue-127385.PErcyB.rst | 1 + Modules/fcntlmodule.c | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2024-11-29-13-06-52.gh-issue-127385.PErcyB.rst diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst index a9fbab3..b4ea3e7 100644 --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -79,6 +79,10 @@ descriptor. On macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE`` and ``F_SETNOSIGPIPE`` constant. +.. versionchanged:: next + On Linux >= 6.1, the :mod:`!fcntl` module exposes the ``F_DUPFD_QUERY`` + to query a file descriptor pointing to the same file. + The module defines the following functions: diff --git a/Misc/NEWS.d/next/Library/2024-11-29-13-06-52.gh-issue-127385.PErcyB.rst b/Misc/NEWS.d/next/Library/2024-11-29-13-06-52.gh-issue-127385.PErcyB.rst new file mode 100644 index 0000000..3770d58 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2024-11-29-13-06-52.gh-issue-127385.PErcyB.rst @@ -0,0 +1 @@ +Add the ``F_DUPFD_QUERY`` constant to the :mod:`fcntl` module. diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c index 81a1e1c..7e14e6b 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -559,6 +559,9 @@ all_ins(PyObject* m) #ifdef F_NOTIFY if (PyModule_AddIntMacro(m, F_NOTIFY)) return -1; #endif +#ifdef F_DUPFD_QUERY + if (PyModule_AddIntMacro(m, F_DUPFD_QUERY)) return -1; +#endif /* Old BSD flock(). */ #ifdef F_EXLCK if (PyModule_AddIntMacro(m, F_EXLCK)) return -1; -- cgit v0.12