changeset 31180:27e3b66ec7c5

dispatch: cope with sys.version being unicode on Python 3
author Augie Fackler <raf@durin42.com>
date Fri, 03 Mar 2017 13:29:50 -0500
parents 49ad6bf63107
children 150cd5125722
files mercurial/dispatch.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Fri Mar 03 13:29:25 2017 -0500
+++ b/mercurial/dispatch.py	Fri Mar 03 13:29:50 2017 -0500
@@ -893,7 +893,12 @@
             bugtracker = _("https://mercurial-scm.org/wiki/BugTracker")
         warning = (_("** unknown exception encountered, "
                      "please report by visiting\n** ") + bugtracker + '\n')
-    warning += ((_("** Python %s\n") % sys.version.replace('\n', '')) +
+    if pycompat.ispy3:
+        sysversion = sys.version.encode(u'utf-8')
+    else:
+        sysversion = sys.version
+    sysversion = sysversion.replace('\n', '')
+    warning += ((_("** Python %s\n") % sysversion) +
                 (_("** Mercurial Distributed SCM (version %s)\n") %
                  util.version()) +
                 (_("** Extensions loaded: %s\n") %