[issue18876] Problems with files opened in append mode with io module

Erik Bray report at bugs.python.org
Thu Aug 29 22:44:36 CEST 2013


Erik Bray added the comment:

>> Whereas the behavior of O_APPEND causes an automatic seek to the end
>> before any write().

> True, but IIRC some systems seek on open() and some systems seek just before write().

I figured that workaround that seeks to the end on open was an attempt to normalize behavior between different systems, and seems to me like a reasonable compromise to support systems that somehow don't support append.

But a better compromise I think would be to seek to the beginning of the file and modify fileio_write and friends to always seek to the end before a write if the file was opened in append mode. This would be more in line with the POSIX behavior.

I have no idea on what systems O_APPEND isn't supported, but I figured they must exist because someone put an #ifdef in there once :)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18876>
_______________________________________


More information about the Python-bugs-list mailing list