[issue12512] codecs: StreamWriter issues with stateful codecs after a seek or with append mode

STINNER Victor report at bugs.python.org
Thu Jul 7 13:20:55 CEST 2011


STINNER Victor <victor.stinner at 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 <report at bugs.python.org>
<http://bugs.python.org/issue12512>
_______________________________________


More information about the Python-bugs-list mailing list