Skip to content

gh-129011: Update docs for Raw I/O read, readinto, and write#135328

Merged
vstinner merged 4 commits into
python:mainfrom
cmaloney:rawio_retry_nonblock
Jun 5, 2026
Merged

gh-129011: Update docs for Raw I/O read, readinto, and write#135328
vstinner merged 4 commits into
python:mainfrom
cmaloney:rawio_retry_nonblock

Conversation

@cmaloney
Copy link
Copy Markdown
Contributor

@cmaloney cmaloney commented Jun 10, 2025

Update RawIOBase and FileIO documentation to match implementation behavior around .read, .readinto, .readall and .write.

see also: gh-80050 / GH-130653 (similar work on Buffered I/O read docs)


📚 Documentation preview 📚: https://cpython-previews--135328.org.readthedocs.build/

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"
@github-actions
Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 26, 2026
@cmaloney cmaloney removed the stale Stale PR or inactive for long period of time. label Apr 26, 2026
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@vstinner, could you please look at this as the author of retry-on-interrupt logic?

@serhiy-storchaka serhiy-storchaka requested a review from vstinner June 2, 2026 17:08
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 2, 2026
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Jun 2, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32996868 | 📁 Comparing c0b547b against main (f7e0fb6)

  🔍 Preview build  

73 files changed · + 1 added · ± 72 modified

+ Added

± Modified

@vstinner
Copy link
Copy Markdown
Member

vstinner commented Jun 4, 2026

Tests / Docs / Docs (pull_request): Failing after 16s

A git command failed with fatal: shallow file has changed since we read it.

Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Doc/library/io.rst Outdated
Comment thread Doc/library/io.rst Outdated
Comment thread Doc/library/io.rst Outdated
Comment thread Doc/library/io.rst Outdated
Co-authored-by: Victor Stinner <vstinner@python.org>
@cmaloney
Copy link
Copy Markdown
Contributor Author

cmaloney commented Jun 4, 2026

FileIO has a .readall() which is used several times in CPython so to duck type replace it with BufferedIO in my I/O plans need to add one calling through to .read(-1). Happy to do that as a small earlier feature add

 - Move to commas around nonessential phrase
 - Expand contraction
@vstinner vstinner merged commit e4db68b into python:main Jun 5, 2026
30 checks passed
@miss-islington-app
Copy link
Copy Markdown

Thanks @cmaloney for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@github-project-automation github-project-automation Bot moved this from Todo to Done in Docs PRs Jun 5, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Jun 5, 2026

GH-150957 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 5, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Jun 5, 2026

GH-150958 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 5, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Jun 5, 2026

GH-150959 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 5, 2026
@vstinner
Copy link
Copy Markdown
Member

vstinner commented Jun 5, 2026

Merged, thanks for the improved io doc.

vstinner added a commit that referenced this pull request Jun 5, 2026
…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>
vstinner added a commit that referenced this pull request Jun 5, 2026
…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>
vstinner added a commit that referenced this pull request Jun 5, 2026
…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>
@cmaloney cmaloney deleted the rawio_retry_nonblock branch June 5, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants