-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-37129: Add os.RWF_APPEND flag for os.pwritev #13735
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. If you have recently signed the CLA, please wait at least one business day You can check yourself to see if the CLA has been received. Thanks again for your contribution, we look forward to reviewing it! |
Doc/library/os.rst
Outdated
|
||
Append data to the end of the file. | ||
|
||
.. availability:: Linux 4.7 and newer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be "Linux 4.16 and newer."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Doc/library/os.rst
Outdated
@@ -1230,6 +1231,15 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Windo | |||
.. versionadded:: 3.7 | |||
|
|||
|
|||
.. data:: RWF_APPEND | |||
|
|||
Append data to the end of the file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Append data to the end of the file. See the description of the flag of the same name in os.pwritev()
as well as the description of O_APPEND
in os.open()
. The offset field is ignored. The file offset is not changed.
@@ -1230,6 +1231,16 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ 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()''. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry "Provide a per-write equivalent of the O_APPEND
in os.open()
. This flag effect applies only to the data range written by the system call. The offset argument does not affect the write operation; the data is always appended to the end of the file. However, if the offset argument is -1
, the current file offset is updated." I am sure vstinner will want to change this description again :)
@@ -5334,6 +5334,7 @@ PyDoc_STRVAR(os_pwritev__doc__, | |||
"\n" | |||
"- RWF_DSYNC\n" | |||
"- RWF_SYNC\n" | |||
"- RWF_APPEND\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must also update posixmodule.c docstring, and then run "make clinic" to regenerate this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was tried travis-ci seems to fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please modify Modules/posixmodule.c and then run "make clinic".
@@ -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 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add - RWF_APPEND
on line: 9396
@@ -1230,6 +1231,16 @@ or `the MSDN <https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ 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()''. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'O_APPEND' should be written :data:O_APPEND
.
''os.open()'' should be written :func:os.open
to add a link.
But os.open() doesn't document O_APPEND, just "The above constants are available on Unix and Windows"...
I would prefer to copy preadv Linux manual page:
RWF_APPEND (since Linux 4.16)
Provide a per-write equivalent of the O_APPEND open(2) flag.
This flag is meaningful only for pwritev2(), and its effect
applies only to the data range written by the system call. The
offset argument does not affect the write operation; the data is
always appended to the end of the file. However, if the offset
argument is -1, the current file offset is updated.
(Adapt it to Python names.)
@@ -0,0 +1 @@ | |||
add RWF_APPEND flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest:
Add a new :data:`os.RWF_APPEND` flag for :func:`os.pwritev`.
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
||
.. availability:: Linux 4.16 and newer. | ||
|
||
.. versionadded:: 3.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. versionadded:: 3.8 | |
.. versionadded:: 3.9 |
The build failure, which I leave to someone else to interpret: |
You can use: ./python Tools/clinic/clinic.py Modules/posixmodule.c -f |
@bezoka: Would you mind to update your PR for my latest comments? (update the doc) This PR can still land into Python 3.8.0, since it only adds a new constant. |
I am going to close this PR as abandoned (the original author has not been active in nearly a year). This is available for someone else to make a new PR. Please credit the original author in the commit message. |
I just noticed that the this PR proposes to merge bezoka's cpython master branch rather than an issue branch from master. This being rather fragile, this should have been closed and redone immediately. It should not be reopened even if it could be. |
https://bugs.python.org/issue37129