aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2021-02-04 08:32:55 +0900
committerGitHub <noreply@github.com>2021-02-04 08:32:55 +0900
commitf917c243c52d62a787738379fb9b97acbed02c17 (patch)
tree4516bfbadf11f83ce17637aac219fb7fdf1ff8ac
parentbpo-43121: Fix incorrect SyntaxError message for missing comma (GH-24436) (diff)
downloadcpython-f917c243c52d62a787738379fb9b97acbed02c17.tar.gz
cpython-f917c243c52d62a787738379fb9b97acbed02c17.tar.bz2
cpython-f917c243c52d62a787738379fb9b97acbed02c17.zip
bpo-43106: Add os.O_EVTONLY/O_FSYNC/O_SYMLINK/O_NOFOLLOW_ANY (GH-24428)
-rw-r--r--Doc/library/os.rst10
-rw-r--r--Doc/whatsnew/3.10.rst4
-rw-r--r--Misc/NEWS.d/next/Library/2021-02-03-17-06-38.bpo-43106.SwcSuU.rst2
-rw-r--r--Modules/posixmodule.c13
4 files changed, 28 insertions, 1 deletions
diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index 35cf7c0a0ba..371d59e9c31 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1090,6 +1090,16 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
The above constants are only available on Windows.
+.. data:: O_EVTONLY
+ O_FSYNC
+ O_SYMLINK
+ O_NOFOLLOW_ANY
+
+ The above constants are only available on macOS.
+
+ .. versionchanged:: 3.10
+ Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK`
+ and :data:`O_NOFOLLOW_ANY` constants.
.. data:: O_ASYNC
O_DIRECT
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index d80ceeca85a..fa8b6aa54fe 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -411,6 +411,10 @@ descriptors without copying between kernel address space and user
address space, where one of the file descriptors must refer to a
pipe. (Contributed by Pablo Galindo in :issue:`41625`.)
+Added :data:`~os.O_EVTONLY`, :data:`~os.O_FSYNC`, :data:`~os.O_SYMLINK`
+and :data:`~os.O_NOFOLLOW_ANY` for macOS.
+(Contributed by Dong-hee Na in :issue:`43106`.)
+
pathlib
-------
diff --git a/Misc/NEWS.d/next/Library/2021-02-03-17-06-38.bpo-43106.SwcSuU.rst b/Misc/NEWS.d/next/Library/2021-02-03-17-06-38.bpo-43106.SwcSuU.rst
new file mode 100644
index 00000000000..a85d49437c4
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-02-03-17-06-38.bpo-43106.SwcSuU.rst
@@ -0,0 +1,2 @@
+Added :data:`~os.O_EVTONLY`, :data:`~os.O_FSYNC`, :data:`~os.O_SYMLINK`
+and :data:`~os.O_NOFOLLOW_ANY` for macOS. Patch by Dong-hee Na.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 4468fd08e17..b30ae802905 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -14901,7 +14901,15 @@ all_ins(PyObject *m)
#ifdef O_ACCMODE
if (PyModule_AddIntMacro(m, O_ACCMODE)) return -1;
#endif
-
+#ifdef O_EVTONLY
+ if (PyModule_AddIntMacro(m, O_EVTONLY)) return -1;
+#endif
+#ifdef O_FSYNC
+ if (PyModule_AddIntMacro(m, O_FSYNC)) return -1;
+#endif
+#ifdef O_SYMLINK
+ if (PyModule_AddIntMacro(m, O_SYMLINK)) return -1;
+#endif
#ifdef SEEK_HOLE
if (PyModule_AddIntMacro(m, SEEK_HOLE)) return -1;
@@ -14951,6 +14959,9 @@ all_ins(PyObject *m)
/* Do not follow links. */
if (PyModule_AddIntMacro(m, O_NOFOLLOW)) return -1;
#endif
+#ifdef O_NOFOLLOW_ANY
+ if (PyModule_AddIntMacro(m, O_NOFOLLOW_ANY)) return -1;
+#endif
#ifdef O_NOLINKS
/* Fails if link count of the named file is greater than 1 */
if (PyModule_AddIntMacro(m, O_NOLINKS)) return -1;