[issue15723] Python breaks OS' append guarantee on file writes
Antoine Pitrou
report at bugs.python.org
Sat Aug 18 22:36:40 CEST 2012
Antoine Pitrou added the comment:
> I have not tried io.open(), nor would I suspect most users would
> realize that they needed to do so, in order to get the canonical
> behaviour from an operation called "write" on a file opened in
> "append" mode.
The reason I'm asking is that open() is the same as io.open() in Python
3.x, which is currently the main development line. That said, I can find
the results myself.
Python 2 is in bugfix mode, so it's impossible to rewrite the I/O
routines to use unbuffered I/O instead of C buffered I/O.
> IMO: If pythons file.write() does not give the guarantee POLA would
> indicate, it's either a bug or a doc-issue, no matter how many
> workarounds might exist.
What do you call POLA?
> But I have neither a clue to the aspirational goals of python, nor to
> what it might take to fix this, so it's entirely your call.
Well as I said, Python 2 will be pretty much impossible to fix (we call
fwrite() with the argument, not write()). Python 3 is a different story
since we use our own buffering layer and then C's unbuffered API.
As a sidenote, do you know if writev() has the same guarantee as
write()? POSIX doesn't seem to say so.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15723>
_______________________________________
More information about the Python-bugs-list
mailing list