Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3bfc8e0

Browse files
corona10serhiy-storchaka
authored andcommitted
bpo-38602: Add fcntl.F_OFD_XXXX for fcntlmodule (GH-16956)
1 parent 85c6f8c commit 3bfc8e0

4 files changed

Lines changed: 22 additions & 1 deletion

File tree

Doc/library/fcntl.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ descriptor.
3636
.. versionchanged:: 3.9
3737
On macOS, the fcntl module exposes the ``F_GETPATH`` constant, which obtains
3838
the path of a file from a file descriptor.
39+
On Linux(>=3.15), the fcntl module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK``
40+
and ``F_OFD_SETLKW`` constants, which working with open file description locks.
3941

4042
The module defines the following functions:
4143

Doc/whatsnew/3.9.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,15 @@ that schedules a shutdown for the default executor that waits on the
125125
:func:`asyncio.run` has been updated to use the new :term:`coroutine`.
126126
(Contributed by Kyle Stanley in :issue:`34037`.)
127127

128+
fcntl
129+
-----
130+
131+
Added constants :data:`~fcntl.F_OFD_GETLK`, :data:`~fcntl.F_OFD_SETLK`
132+
and :data:`~fcntl.F_OFD_SETLKW`.
133+
(Contributed by Dong-hee Na in :issue:`38602`.)
134+
128135
os
129-
__
136+
--
130137

131138
Added :data:`~os.CLD_KILLED` and :data:`~os.CLD_STOPPED` for :attr:`si_code`.
132139
(Contributed by Dong-hee Na in :issue:`38493`.)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Added constants :data:`~fcntl.F_OFD_GETLK`, :data:`~fcntl.F_OFD_SETLK`
2+
and :data:`~fcntl.F_OFD_SETLKW` to the :mod:`fcntl` module.
3+
Patch by Dong-hee Na.

Modules/fcntlmodule.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,15 @@ all_ins(PyObject* m)
495495
#ifdef F_SETLKW
496496
if (PyModule_AddIntMacro(m, F_SETLKW)) return -1;
497497
#endif
498+
#ifdef F_OFD_GETLK
499+
if (PyModule_AddIntMacro(m, F_OFD_GETLK)) return -1;
500+
#endif
501+
#ifdef F_OFD_SETLK
502+
if (PyModule_AddIntMacro(m, F_OFD_SETLK)) return -1;
503+
#endif
504+
#ifdef F_OFD_SETLKW
505+
if (PyModule_AddIntMacro(m, F_OFD_SETLKW)) return -1;
506+
#endif
498507
#ifdef F_GETOWN
499508
if (PyModule_AddIntMacro(m, F_GETOWN)) return -1;
500509
#endif

0 commit comments

Comments
 (0)