[Python-checkins] bpo-26835: Add file sealing constants to fcntl (GH-13694)

Christian Heimes webhook-mailer at python.org
Fri May 31 12:32:37 EDT 2019


https://github.com/python/cpython/commit/8cbb5b6625268400d6e9092b75b06d6f90398dc9
commit: 8cbb5b6625268400d6e9092b75b06d6f90398dc9
branch: master
author: Christian Heimes <christian at python.org>
committer: GitHub <noreply at github.com>
date: 2019-05-31T18:32:33+02:00
summary:

bpo-26835: Add file sealing constants to fcntl (GH-13694)

Co-authored-by: nanjekyejoannah <nanjekyejoannah at gmail.com>

files:
A Misc/NEWS.d/next/Library/2019-05-31-11-33-11.bpo-26835.xGbUX0.rst
M Doc/library/fcntl.rst
M Modules/fcntlmodule.c

diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst
index 88112f6b7e54..2db9674952d7 100644
--- a/Doc/library/fcntl.rst
+++ b/Doc/library/fcntl.rst
@@ -28,6 +28,10 @@ descriptor.
    Operations in this module used to raise an :exc:`IOError` where they now
    raise an :exc:`OSError`.
 
+.. versionchanged:: 3.8
+   The fcntl module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and
+   ``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file
+   descriptors.
 
 The module defines the following functions:
 
diff --git a/Misc/NEWS.d/next/Library/2019-05-31-11-33-11.bpo-26835.xGbUX0.rst b/Misc/NEWS.d/next/Library/2019-05-31-11-33-11.bpo-26835.xGbUX0.rst
new file mode 100644
index 000000000000..1c5ed97a7d19
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-05-31-11-33-11.bpo-26835.xGbUX0.rst
@@ -0,0 +1 @@
+The fcntl module now contains file sealing constants for sealing of memfds.
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
index a938d9e88bf0..0fbf7876c3e2 100644
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -620,7 +620,15 @@ all_ins(PyObject* m)
     if (PyModule_AddIntMacro(m, I_PLINK)) return -1;
     if (PyModule_AddIntMacro(m, I_PUNLINK)) return -1;
 #endif
-
+#ifdef F_ADD_SEALS
+    /* Linux: file sealing for memfd_create() */
+    if (PyModule_AddIntMacro(m, F_ADD_SEALS)) return -1;
+    if (PyModule_AddIntMacro(m, F_GET_SEALS)) return -1;
+    if (PyModule_AddIntMacro(m, F_SEAL_SEAL)) return -1;
+    if (PyModule_AddIntMacro(m, F_SEAL_SHRINK)) return -1;
+    if (PyModule_AddIntMacro(m, F_SEAL_GROW)) return -1;
+    if (PyModule_AddIntMacro(m, F_SEAL_WRITE)) return -1;
+#endif
     return 0;
 }
 



More information about the Python-checkins mailing list