[issue22651] Python 2: Open file in a+ mode on Windows doesn't go to the end

STINNER Victor report at bugs.python.org
Thu Oct 16 10:03:34 CEST 2014


STINNER Victor added the comment:

Python 3 documentation is explicit about the "a" mode:
"open for writing, appending *to the end* of the file if it exists"
https://docs.python.org/dev/library/functions.html#open

Python 2 is based on the stdio.h of the C standard library which behaves differently. fopen() documentation:
"Open for appending (writing *at end of file*).
http://linux.die.net/man/3/fopen

IMO it's a bug in the C library. It's probably yet another bug in the C standard library on Windows:
http://haypo-notes.readthedocs.org/python.html#bugs-in-the-c-stdio-used-by-the-python-i-o

----------
components: +Windows
nosy: +haypo, pitrou, steve.dower, tim.golden, zach.ware
title: Open file in a+ mode reads from end of file in Python 3.4 -> Python 2: Open file in a+ mode on Windows doesn't go to the end

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


More information about the Python-bugs-list mailing list