[issue29783] Modify codecs.open() to use the io module instead of codecs.StreamReaderWriter()

Serhiy Storchaka report at bugs.python.org
Fri Mar 10 09:33:11 EST 2017


Serhiy Storchaka added the comment:

codecs.open() works with bytes-to-bytes codecs.

>>> f = codecs.open('test1', 'w', encoding='hex_codec')
>>> f.write(b'hello')
>>> f.close()
>>> open('test1', 'rb').read()
b'68656c6c6f'

In additional the interface of StreamReaderWriter is not fully compatible with the interface of io classes. This would be compatible-breaking change.

----------

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


More information about the Python-bugs-list mailing list