Patchwork [1,of,8,py3] py3: convert function name to bytes in ui.configwith()

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 16, 2017, 2:31 p.m.
Message ID <3592f41c8c14cee0c2ee.1505572285@mimosa>
Download mbox | patch
Permalink /patch/23936/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 16, 2017, 2:31 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1504428441 -32400
#      Sun Sep 03 17:47:21 2017 +0900
# Node ID 3592f41c8c14cee0c2ee103da254193a486bca35
# Parent  5a1b41268b7c7418b3bdd446a6ff53fa7d694c86
py3: convert function name to bytes in ui.configwith()

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -595,7 +595,7 @@  class ui(object):
             return convert(v)
         except (ValueError, error.ParseError):
             if desc is None:
-                desc = convert.__name__
+                desc = pycompat.sysbytes(convert.__name__)
             raise error.ConfigError(_("%s.%s is not a valid %s ('%s')")
                                     % (section, name, desc, v))
 
diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -68,7 +68,7 @@  testmod('mercurial.store', py3=False)  #
 testmod('mercurial.subrepo')
 testmod('mercurial.templatefilters')
 testmod('mercurial.templater')
-testmod('mercurial.ui', py3=False)  # py3: __name__
+testmod('mercurial.ui')
 testmod('mercurial.url')
 testmod('mercurial.util', py3=False)  # py3: multiple bytes/unicode issues
 testmod('mercurial.util', testtarget='platform')