[Python-checkins] bpo-38602: Add fcntl.F_OFD_XXXX for fcntlmodule (GH-16956)

Serhiy Storchaka webhook-mailer at python.org
Mon Oct 28 03:31:35 EDT 2019


https://github.com/python/cpython/commit/3bfc8e0fcc707d200c267ff05b052fd6a63c985a
commit: 3bfc8e0fcc707d200c267ff05b052fd6a63c985a
branch: master
author: Dong-hee Na <donghee.na92 at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2019-10-28T09:31:15+02:00
summary:

bpo-38602: Add fcntl.F_OFD_XXXX for fcntlmodule (GH-16956)

files:
A Misc/NEWS.d/next/Library/2019-10-27-22-29-45.bpo-38602.7jvYFA.rst
M Doc/library/fcntl.rst
M Doc/whatsnew/3.9.rst
M Modules/fcntlmodule.c

diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst
index da39c3187a1e3..5c172b836acca 100644
--- a/Doc/library/fcntl.rst
+++ b/Doc/library/fcntl.rst
@@ -36,6 +36,8 @@ descriptor.
 .. versionchanged:: 3.9
    On macOS, the fcntl module exposes the ``F_GETPATH`` constant, which obtains
    the path of a file from a file descriptor.
+   On Linux(>=3.15), the fcntl module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK``
+   and ``F_OFD_SETLKW`` constants, which working with open file description locks.
 
 The module defines the following functions:
 
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index b95b0999cb952..886c555c7b1d6 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -125,8 +125,15 @@ that schedules a shutdown for the default executor that waits on the
 :func:`asyncio.run` has been updated to use the new :term:`coroutine`.
 (Contributed by Kyle Stanley in :issue:`34037`.)
 
+fcntl
+-----
+
+Added constants :data:`~fcntl.F_OFD_GETLK`, :data:`~fcntl.F_OFD_SETLK`
+and :data:`~fcntl.F_OFD_SETLKW`.
+(Contributed by Dong-hee Na in :issue:`38602`.)
+
 os
-__
+--
 
 Added :data:`~os.CLD_KILLED` and :data:`~os.CLD_STOPPED` for :attr:`si_code`.
 (Contributed by Dong-hee Na in :issue:`38493`.)
diff --git a/Misc/NEWS.d/next/Library/2019-10-27-22-29-45.bpo-38602.7jvYFA.rst b/Misc/NEWS.d/next/Library/2019-10-27-22-29-45.bpo-38602.7jvYFA.rst
new file mode 100644
index 0000000000000..9b8229b4a024c
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-10-27-22-29-45.bpo-38602.7jvYFA.rst
@@ -0,0 +1,3 @@
+Added constants :data:`~fcntl.F_OFD_GETLK`, :data:`~fcntl.F_OFD_SETLK`
+and :data:`~fcntl.F_OFD_SETLKW` to the :mod:`fcntl` module.
+Patch by Dong-hee Na.
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
index cfa1225684049..1e5b0f7faea6f 100644
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -495,6 +495,15 @@ all_ins(PyObject* m)
 #ifdef F_SETLKW
     if (PyModule_AddIntMacro(m, F_SETLKW)) return -1;
 #endif
+#ifdef F_OFD_GETLK
+    if (PyModule_AddIntMacro(m, F_OFD_GETLK)) return -1;
+#endif
+#ifdef F_OFD_SETLK
+    if (PyModule_AddIntMacro(m, F_OFD_SETLK)) return -1;
+#endif
+#ifdef F_OFD_SETLKW
+    if (PyModule_AddIntMacro(m, F_OFD_SETLKW)) return -1;
+#endif
 #ifdef F_GETOWN
     if (PyModule_AddIntMacro(m, F_GETOWN)) return -1;
 #endif



More information about the Python-checkins mailing list