[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2015-04-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: Fix is pushed. Thanks for the report! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___ ___

[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2015-04-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset 946740824eaf by Antoine Pitrou in branch '3.4': Issue #22982: Improve BOM handling when seeking to multiple positions of a writable text file. https://hg.python.org/cpython/rev/946740824eaf New changeset 3583e5191b96 by Antoine Pitrou in branch 'de

[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2014-12-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a patch. -- keywords: +patch stage: -> patch review versions: +Python 3.5 Added file: http://bugs.python.org/file37378/bom_seek_append.patch ___ Python tracker ___

[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2014-12-03 Thread Mark Ingram
Mark Ingram added the comment: It's more than a limitation, because if I call `file.seek(0, io.SEEK_END)` then the encoder is still reset, and will still write the BOM, even at the end of the file. This also means that it's impossible to seek in a text file that you want to append to. I've ha

[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2014-12-03 Thread Antoine Pitrou
Antoine Pitrou added the comment: This is a limitation more than a bug. When you seek to the start of the file, the encoder is reset because Python thinks you are gonna to write there. If you remove the call to `file.seek(0, io.SEEK_SET)`, things work fine. @Amaury, whence can only be zero the

[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2014-12-02 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: issue5006 was supposed to take care of this, but it has a flaw IMO: This statement https://hg.python.org/cpython/file/0744ceb5c0ed/Lib/_pyio.py#l2003 is missing an "and whence!=2". -- nosy: +amaury.forgeotdarc ___

[issue22982] BOM incorrectly inserted before writing, after seeking in text file

2014-12-02 Thread MarkIngramUK
New submission from MarkIngramUK: If you open a text file for append, but then perform any form of seeking, before attempting to write to the file, it will cause the BOM to be written before you text. See the attached file for an example. If you run the test, take a look at the output file, an