STINNER Victor <victor.stin...@haypocalc.com> added the comment:

There is a similar bug for append mode:

import codecs
_open = codecs.open
#_open = open
filename = "test"
with _open(filename, 'w', encoding='utf_16') as f:
    f.write('abc')
with _open(filename, 'a', encoding='utf_16') as f:
    f.write('def')
with _open(filename, 'r', encoding='utf_16') as f:
    content = f.read()
    assert content == 'abcdef', ascii(content)

This bug has also been fixed by the issue #5006 in the io module.

----------
title: codecs: StreamWriter issue with stateful codecs after a seek -> codecs: 
StreamWriter issues with stateful codecs after a seek or with append mode

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue12512>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to