gh-129011: Update docs for Raw I/O read, readinto, and write#135328
Conversation
Update `RawIOBase` and `FileIO` documentation to match implementation behavior around `.read`, `.readinto`, `.readall` and `.write`. In particular: - They may make more than one system call (PEP-475) - Add warnings if `.write()` requires a wrapping retry loop (see: pythongh-126606) - "Raw I/O" `.write`` may not write all bytes - `buffering=0` example results in a "Raw I/O"
|
This PR is stale because it has been open for 30 days with no activity. |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
LGTM. 👍
@vstinner, could you please look at this as the author of retry-on-interrupt logic?
Documentation build overview
73 files changed ·
|
A |
vstinner
left a comment
There was a problem hiding this comment.
LGTM. I just have some minor formatting suggestions.
Sometimes, I wish that the io module has readall() and writeall() methods, similar to socket sendall() method.
Co-authored-by: Victor Stinner <vstinner@python.org>
|
|
- Move to commas around nonessential phrase - Expand contraction
|
GH-150957 is a backport of this pull request to the 3.15 branch. |
|
GH-150958 is a backport of this pull request to the 3.14 branch. |
|
GH-150959 is a backport of this pull request to the 3.13 branch. |
|
Merged, thanks for the improved io doc. |
…H-135328) (#150959) gh-129011: Update docs for Raw I/O read, readinto, and write (GH-135328) Update `RawIOBase` and `FileIO` documentation to match implementation behavior around `.read`, `.readinto`, `.readall` and `.write`. In particular: - They may make more than one system call (PEP-475) - Add warnings if `.write()` requires a wrapping retry loop (see: gh-126606) - "Raw I/O" `.write`` may not write all bytes - `buffering=0` example results in a "Raw I/O" (cherry picked from commit e4db68b) Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
…H-135328) (#150958) gh-129011: Update docs for Raw I/O read, readinto, and write (GH-135328) Update `RawIOBase` and `FileIO` documentation to match implementation behavior around `.read`, `.readinto`, `.readall` and `.write`. In particular: - They may make more than one system call (PEP-475) - Add warnings if `.write()` requires a wrapping retry loop (see: gh-126606) - "Raw I/O" `.write`` may not write all bytes - `buffering=0` example results in a "Raw I/O" (cherry picked from commit e4db68b) Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
…H-135328) (#150957) gh-129011: Update docs for Raw I/O read, readinto, and write (GH-135328) Update `RawIOBase` and `FileIO` documentation to match implementation behavior around `.read`, `.readinto`, `.readall` and `.write`. In particular: - They may make more than one system call (PEP-475) - Add warnings if `.write()` requires a wrapping retry loop (see: gh-126606) - "Raw I/O" `.write`` may not write all bytes - `buffering=0` example results in a "Raw I/O" (cherry picked from commit e4db68b) Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
Update
RawIOBaseandFileIOdocumentation to match implementation behavior around.read,.readinto,.readalland.write..write()requires a wrapping retry loop (see: Corrupt .pyc files stay on disk after failed writes #126606).writemay not write all bytesbuffering=0example results in a "Raw I/O"see also: gh-80050 / GH-130653 (similar work on Buffered I/O read docs)
📚 Documentation preview 📚: https://cpython-previews--135328.org.readthedocs.build/