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

This commit is contained in:
Clay Dugo 2026-01-06 09:35:51 -05:00 committed by GitHub
parent 71119a164c
commit d745b60ef2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 18 additions and 2 deletions

View file

@ -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.

View file

@ -0,0 +1 @@
Add :data:`os.RWF_ATOMIC` constant for Linux 6.11+.

View file

@ -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 @@ exit:
#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]*/

View file

@ -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