[PATCH 3 of 3] py3: make keys of keyword arguments strings
yuya at tcha.org
Sun Dec 11 08:39:33 EST 2016
On Sat, 10 Dec 2016 05:10:27 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1481085372 -19800
> # Wed Dec 07 10:06:12 2016 +0530
> # Node ID 28203092739274efcb8c691beb9c4025a2c45ff5
> # Parent 7fcea54acba98b7f1d994bd7311bb0f5ec566b65
> 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. We need to convert the keys
> to unicodes to make the code run. We have to also reverse this process so that
> functions on args dictionary like get() etc. don't result in key not found.
> Also after this patch, `hg version` now runs on Python 3.5. Hurray!
> diff -r 7fcea54acba9 -r 282030927392 mercurial/dispatch.py
> --- a/mercurial/dispatch.py Wed Dec 07 21:53:03 2016 +0530
> +++ b/mercurial/dispatch.py Wed Dec 07 10:06:12 2016 +0530
> @@ -803,6 +803,7 @@
> msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
> ui.log("command", '%s\n', msg)
> + cmdoptions = pycompat.strkwargs(cmdoptions)
> d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
> return runcommand(lui, repo, cmd, fullargs, ui, options, d,
'cmdoptions' is passed to another function as a normal dict, which shouldn't
be a dict of unicode keys. Only **cmdoptions should be a unicode-key dict.
Sorry I didn't notice it in earlier series.
More information about the Mercurial-devel