diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst index 7bd64e43dd5bfe..30e0fdaa311924 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 00000000000000..3770d586ba4620 --- /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 90ebfd7e99a777..72cdc34a31d2f7 100644 --- a/Modules/fcntlmodule.c +++ b/Modules/fcntlmodule.c @@ -565,6 +565,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;