# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2016-12-13 15:23:40 # Node ID 2d555d753f0e2f7bdb427bb125be416f791c00f6 # Parent 0f865311ae3f9020616c9ee21ffdf5580ccc4436 py3: make keys of keyword arguments strings keys of keyword arguments on Python 3 has to be string. We are dealing with bytes in our codebase so the keys are also bytes. Done that using pycompat.strkwargs(). Also after this patch, `hg version` now runs on Python 3.5. Hurray! diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -803,7 +803,8 @@ def _dispatch(req): msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) ui.log("command", '%s\n', msg) - d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) + strcmdopt = pycompat.strkwargs(cmdoptions) + d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) try: return runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions) diff --git a/tests/test-check-py3-commands.t b/tests/test-check-py3-commands.t --- a/tests/test-check-py3-commands.t +++ b/tests/test-check-py3-commands.t @@ -9,6 +9,6 @@ The full traceback is hidden to have a s > $PYTHON3 `which hg` $cmd 2>&1 2>&1 | tail -1 > done version - TypeError: Can't convert 'bytes' object to str implicitly + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. debuginstall TypeError: Can't convert 'bytes' object to str implicitly