STINNER Victor added the comment: 2013/10/8 Augie Fackler <rep...@bugs.python.org>: > sys.stdout.write('%(state)s %(path)s\n' % {'state': 'M', 'path': > 'some/filesystem/path'}) > > except we don't know the encoding of the filesystem path (Hi unix!) so we > have to treat the whole thing as opaque bytes.
You are doing it wrong. In Python 3, you "should" store filenames as Unicode (str type). If Python fails to decode a filename, undecodable bytes are stored as surrogate characters (see the PEP 383). The Unicode type became natural in Python 3, as byte string (old "str" type) was natural in Python 2. sys.stdout.write() expects a Unicode string, not a byte string. Does it mean that Mercurial is moving to Python 3? Cool :-) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue3982> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com