TextIO and BufferedIO (which are gotten via commonly used open('README.rst'), open('README.rst', 'rb')) retry partial writes providing a user a guarantee either all bytes will be written or an exception will be thrown.
FileIO is "Raw I/O" and by PEP-3116 design, as documented, and currently implemented does not retry partial writes.
I would like to try and change the behavior of buffering=0 to use BufferedIO but with a 0 sized buffer, and that is on my roadmap but will be a while (people use the flag for a reason / get benefit!). This will mean open() always returns an object which implements "Write all or throw exception" behavior.
Add warning / document existing behavior on open() in the meantime.
Activity
gh-129011: Update comments in FileIO to match current code (#129012)
pythongh-129011: Update docs for Raw I/O read, readinto, and write
gh-129011: Update docs for Raw I/O read, readinto, and write (#135328)
[3.13] gh-129011: Update docs for Raw I/O read, readinto, and write (G…
[3.14] gh-129011: Update docs for Raw I/O read, readinto, and write (G…
[3.15] gh-129011: Update docs for Raw I/O read, readinto, and write (G…
pythongh-129011: Update docs for Raw I/O read, readinto, and write (p…
cmaloney commented on Jul 5, 2026
Reopening as the FileIO section of the io docs needs the change from "only one system call" -> PEP-475 retries