[issue5541] File's current position inconsistent with 'a+' mode

2009-03-23 Thread Martin v. Löwis
Martin v. Löwis added the comment: In 2.x, the mode will do whatever the C library does; this is as it ought to be. Standard C lets it explicitly implementation-defined whether the file position pointer is initially at the beginning or at the end of a file when the file is opened for append. Any

[issue5541] File's current position inconsistent with 'a+' mode

2009-03-23 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- priority: -> normal type: -> behavior versions: +Python 2.7 -Python 2.5 ___ Python tracker ___ ___ Pyt

[issue5541] File's current position inconsistent with 'a+' mode

2009-03-23 Thread Antoine Pitrou
Antoine Pitrou added the comment: The right answer IMO is that the current position should be set to the end of the file, since it is opened in "append" mode. What happens actually is that, on some systems, the position is implicitly set to the end of the file on the first write() rather than wh

[issue5541] File's current position inconsistent with 'a+' mode

2009-03-23 Thread Lukas Lueg
New submission from Lukas Lueg : The file pointer's behaviour after opening a file in 'a+b' mode is not consistent among platforms: The pointer is set to the beginning of the file on Linux and to the end of the file on MacOS. You have to call .seek(0) before calling .read() to get consistent beha