[PATCH] py3: add an os.fsencode backport to ease path handling

Yuya Nishihara yuya at tcha.org
Mon Oct 10 14:57:24 EDT 2016


On Mon, 10 Oct 2016 12:48:32 +0200, Martijn Pieters wrote:
> On 9 October 2016 at 22:51, Yuya Nishihara <yuya at tcha.org> wrote:
> >
> > It appears that 'surrogateescape' is a Python 3 thing. We have
> > encoding.fromutf8b/toutf8b() which should do the same thing for 'utf-8',
> > but
> > I have no idea how 'surrogateescape' works for the other encodings.
> 
> Oh crumbs. That's true. We could also just use strict or ever not support
> unicode in Python 2 *at all*; the number of unicode paths in Py2 in
> mercurial should be 0 *anyway*. The function is mostly there to make it
> easier to write code that works both on 2 and 3 and the encoding is only
> needed in 3 really.

+1 for dropping unicode support on Py2 so we can be sure no unicode paths
are used on Python 2.


More information about the Mercurial-devel mailing list