https://github.com/python/cpython/commit/d745b60ef234228beea30e8d182358f29ffb1cb4
commit: d745b60ef234228beea30e8d182358f29ffb1cb4
branch: main
author: Clay Dugo <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2026-01-06T09:35:51-05:00
summary:

gh-143474: Add `os.RWF_ATOMIC` constant (GH-143475)

files:
A Misc/NEWS.d/next/Library/2026-01-06-12-00-00.gh-issue-143474.cQM4VA.rst
M Doc/library/os.rst
M Modules/clinic/posixmodule.c.h
M Modules/posixmodule.c

diff --git a/Doc/library/os.rst b/Doc/library/os.rst
index f75ad4e67a66d7..9a9b79e7906cc3 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1556,6 +1556,15 @@ or `the MSDN 
<https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
    .. versionadded:: 3.15
 
 
+.. data:: RWF_ATOMIC
+
+   Write data atomically. Requires alignment to the device's atomic write unit.
+
+   .. availability:: Linux >= 6.11
+
+   .. versionadded:: next
+
+
 .. function:: ptsname(fd, /)
 
    Return the name of the slave pseudo-terminal device associated with the
@@ -1598,6 +1607,7 @@ or `the MSDN 
<https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
    - :data:`RWF_SYNC`
    - :data:`RWF_APPEND`
    - :data:`RWF_DONTCACHE`
+   - :data:`RWF_ATOMIC`
 
    Return the total number of bytes actually written.
 
diff --git 
a/Misc/NEWS.d/next/Library/2026-01-06-12-00-00.gh-issue-143474.cQM4VA.rst 
b/Misc/NEWS.d/next/Library/2026-01-06-12-00-00.gh-issue-143474.cQM4VA.rst
new file mode 100644
index 00000000000000..b3aa69f80aa913
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-01-06-12-00-00.gh-issue-143474.cQM4VA.rst
@@ -0,0 +1 @@
+Add :data:`os.RWF_ATOMIC` constant for Linux 6.11+.
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index d880fc52bb370d..03c0f221ba98b3 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -8692,6 +8692,7 @@ PyDoc_STRVAR(os_pwritev__doc__,
 "- RWF_SYNC\n"
 "- RWF_APPEND\n"
 "- RWF_DONTCACHE\n"
+"- RWF_ATOMIC\n"
 "\n"
 "Using non-zero flags requires Linux 4.7 or newer.");
 
@@ -13610,4 +13611,4 @@ os__emscripten_log(PyObject *module, PyObject *const 
*args, Py_ssize_t nargs, Py
 #ifndef OS__EMSCRIPTEN_LOG_METHODDEF
     #define OS__EMSCRIPTEN_LOG_METHODDEF
 #endif /* !defined(OS__EMSCRIPTEN_LOG_METHODDEF) */
-/*[clinic end generated code: output=82f60940338c70e4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5fd2aeb6ba9a5df8 input=a9049054013a1b77]*/
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index b26785abc3cd27..49214d57a2e362 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -12863,6 +12863,7 @@ The flags argument contains a bitwise OR of zero or 
more of the following flags:
 - RWF_SYNC
 - RWF_APPEND
 - RWF_DONTCACHE
+- RWF_ATOMIC
 
 Using non-zero flags requires Linux 4.7 or newer.
 [clinic start generated code]*/
@@ -12870,7 +12871,7 @@ Using non-zero flags requires Linux 4.7 or newer.
 static Py_ssize_t
 os_pwritev_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
                 int flags)
-/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=664a67626d485665]*/
+/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=7de72245873f56bf]*/
 {
     Py_ssize_t cnt;
     Py_ssize_t result;
@@ -18120,6 +18121,9 @@ all_ins(PyObject *m)
 #ifdef RWF_DONTCACHE
     if (PyModule_AddIntConstant(m, "RWF_DONTCACHE", RWF_DONTCACHE)) return -1;
 #endif
+#ifdef RWF_ATOMIC
+    if (PyModule_AddIntConstant(m, "RWF_ATOMIC", RWF_ATOMIC)) return -1;
+#endif
 #ifdef RWF_APPEND
     if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1;
 #endif

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to