https://github.com/python/cpython/commit/e163fbdeda17104f3782afcae557c0211a2ba0a6
commit: e163fbdeda17104f3782afcae557c0211a2ba0a6
branch: main
author: Benjamin Peterson <[email protected]>
committer: benjaminp <[email protected]>
date: 2025-09-18T08:13:23-07:00
summary:

fixes gh-139090: add os.RWF_DONTCACHE (#139091)

files:
A Misc/NEWS.d/next/Library/2025-09-17-21-52-30.gh-issue-139090.W7vbhF.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 2e04fbb6f63fd3..b7fa365166d608 100644
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -1501,6 +1501,7 @@ or `the MSDN 
<https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
 
    - :data:`RWF_HIPRI`
    - :data:`RWF_NOWAIT`
+   - :data:`RWF_DONTCACHE`
 
    Return the total number of bytes actually read which can be less than the
    total capacity of all the objects.
@@ -1546,6 +1547,15 @@ or `the MSDN 
<https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
    .. versionadded:: 3.7
 
 
+.. data:: RWF_DONTCACHE
+
+   Use uncached buffered IO.
+
+   .. availability:: Linux >= 6.14
+
+   .. versionadded:: next
+
+
 .. function:: ptsname(fd, /)
 
    Return the name of the slave pseudo-terminal device associated with the
@@ -1587,6 +1597,7 @@ or `the MSDN 
<https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo
    - :data:`RWF_DSYNC`
    - :data:`RWF_SYNC`
    - :data:`RWF_APPEND`
+   - :data:`RWF_DONTCACHE`
 
    Return the total number of bytes actually written.
 
diff --git 
a/Misc/NEWS.d/next/Library/2025-09-17-21-52-30.gh-issue-139090.W7vbhF.rst 
b/Misc/NEWS.d/next/Library/2025-09-17-21-52-30.gh-issue-139090.W7vbhF.rst
new file mode 100644
index 00000000000000..129914abb10168
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-09-17-21-52-30.gh-issue-139090.W7vbhF.rst
@@ -0,0 +1 @@
+Add :data:`os.RWF_DONTCACHE` constant for Linux 6.14+.
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index 45e7c0d6451c15..dddf98d127c15f 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -7814,6 +7814,7 @@ PyDoc_STRVAR(os_preadv__doc__,
 "\n"
 "- RWF_HIPRI\n"
 "- RWF_NOWAIT\n"
+"- RWF_DONTCACHE\n"
 "\n"
 "Using non-zero flags requires Linux 4.6 or newer.");
 
@@ -8555,6 +8556,7 @@ PyDoc_STRVAR(os_pwritev__doc__,
 "- RWF_DSYNC\n"
 "- RWF_SYNC\n"
 "- RWF_APPEND\n"
+"- RWF_DONTCACHE\n"
 "\n"
 "Using non-zero flags requires Linux 4.7 or newer.");
 
@@ -13444,4 +13446,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=92662828d49f5d88 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b5b370c499174f85 input=a9049054013a1b77]*/
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 62b0c35602323f..6da90dc95addce 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -11756,6 +11756,7 @@ The flags argument contains a bitwise OR of zero or 
more of the following flags:
 
 - RWF_HIPRI
 - RWF_NOWAIT
+- RWF_DONTCACHE
 
 Using non-zero flags requires Linux 4.6 or newer.
 [clinic start generated code]*/
@@ -11763,7 +11764,7 @@ Using non-zero flags requires Linux 4.6 or newer.
 static Py_ssize_t
 os_preadv_impl(PyObject *module, int fd, PyObject *buffers, Py_off_t offset,
                int flags)
-/*[clinic end generated code: output=26fc9c6e58e7ada5 input=c1f876866fcd9d41]*/
+/*[clinic end generated code: output=26fc9c6e58e7ada5 input=34fb3b9ca06f7ba7]*/
 {
     Py_ssize_t cnt, n;
     int async_err = 0;
@@ -12413,6 +12414,7 @@ The flags argument contains a bitwise OR of zero or 
more of the following flags:
 - RWF_DSYNC
 - RWF_SYNC
 - RWF_APPEND
+- RWF_DONTCACHE
 
 Using non-zero flags requires Linux 4.7 or newer.
 [clinic start generated code]*/
@@ -12420,7 +12422,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=99d8a21493ff76ca]*/
+/*[clinic end generated code: output=e3dd3e9d11a6a5c7 input=664a67626d485665]*/
 {
     Py_ssize_t cnt;
     Py_ssize_t result;
@@ -17646,6 +17648,9 @@ all_ins(PyObject *m)
 #ifdef RWF_NOWAIT
     if (PyModule_AddIntConstant(m, "RWF_NOWAIT", RWF_NOWAIT)) return -1;
 #endif
+#ifdef RWF_DONTCACHE
+    if (PyModule_AddIntConstant(m, "RWF_DONTCACHE", RWF_DONTCACHE)) 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