# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1478402303 -32400 # Node ID 8321b083a83d4412874529fd1489f67bf37124dc # Parent 42af0590f4b96e99a3228f76cfad0c9d66d0c5b4 py3: make util.datapath a bytes variable In this patch we make util.datapath a bytes variable, but we have to pass a unicode to gettext.translation otherwise it will cry. Used pycompat.fsdecode() to decode it back to unicode as it was converted to bytes using pycompat.fsencode(). diff -r 42af0590f4b9 -r 8321b083a83d mercurial/i18n.py --- a/mercurial/i18n.py Sun Nov 06 03:12:40 2016 +0530 +++ b/mercurial/i18n.py Sun Nov 06 12:18:23 2016 +0900 @@ -49,6 +49,7 @@ _ugettext = None def setdatapath(datapath): + datapath = pycompat.fsdecode(datapath) localedir = os.path.join(datapath, pycompat.sysstr('locale')) t = gettextmod.translation('hg', localedir, _languages, fallback=True) global _ugettext diff -r 42af0590f4b9 -r 8321b083a83d mercurial/util.py --- a/mercurial/util.py Sun Nov 06 03:12:40 2016 +0530 +++ b/mercurial/util.py Sun Nov 06 12:18:23 2016 +0900 @@ -938,6 +938,9 @@ else: datapath = os.path.dirname(__file__) +if not isinstance(datapath, bytes): + datapath = pycompat.fsencode(datapath) + i18n.setdatapath(datapath) _hgexecutable = None