Oct. 23, 2014
5:20 p.m.
Terry J. Reedy added the comment: The revised doc admits the problem: "If *ensure_ascii* is False, some chunks written to *fp* may be unicode instances. Unless fp.write() explicitly understands unicode (as in codecs.getwriter) this is likely to cause an error." Making text be unicode in 3.x is our attempt at a generic fix to the problems resulting from the bug-prone 2.x 'text may be bytes or unicode' design. Since continued 2.7 support is aimed at supporting legacy code, we are very reluctant to make behavior changes that could break working code. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13769> _______________________________________