diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 107764ba4d539e..39930b5aa1d1f4 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1196,6 +1196,7 @@ or `the MSDN `_ on Windo - :data:`RWF_DSYNC` - :data:`RWF_SYNC` + - :data:`RWF_APPEND` Return the total number of bytes actually written. @@ -1230,6 +1231,16 @@ or `the MSDN `_ on Windo .. versionadded:: 3.7 +.. data:: RWF_APPEND + + Append data to the end of the file. See the description of the flag 'O_APPEND' in ''os.open()''. + The *offset* field is ignored. The file *offset* is not changed. + + .. availability:: Linux 4.16 and newer. + + .. versionadded:: 3.8 + + .. function:: read(fd, n) Read at most *n* bytes from file descriptor *fd*. diff --git a/Misc/NEWS.d/next/Library/2019-06-01-21-58-50.bpo-37129.Uzw_V-.rst b/Misc/NEWS.d/next/Library/2019-06-01-21-58-50.bpo-37129.Uzw_V-.rst new file mode 100644 index 00000000000000..3bbc2e04e11032 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-06-01-21-58-50.bpo-37129.Uzw_V-.rst @@ -0,0 +1 @@ +add RWF_APPEND flag \ No newline at end of file diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 22cb94761de5c7..97aa10c74e72cc 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -5334,6 +5334,7 @@ PyDoc_STRVAR(os_pwritev__doc__, "\n" "- RWF_DSYNC\n" "- RWF_SYNC\n" +"- RWF_APPEND\n" "\n" "Using non-zero flags requires Linux 4.7 or newer."); diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 8f6cffffcdfbe8..a9c82008ff0198 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -14023,6 +14023,9 @@ all_ins(PyObject *m) #ifdef RWF_NOWAIT if (PyModule_AddIntConstant(m, "RWF_NOWAIT", RWF_NOWAIT)) return -1; #endif +#ifdef RWF_APPEND + if (PyModule_AddIntConstant(m, "RWF_APPEND", RWF_APPEND)) return -1; +#endif /* constants for posix_spawn */ #ifdef HAVE_POSIX_SPAWN