changeset 41900:47125193bad0

py3: convert indexes into bytes when enumerating lists in urlencodenested Otherwise it'll try to insert them them into a %s slot in a b'' later and fail. Differential Revision: https://phab.mercurial-scm.org/D6105
author Ian Moody <moz-ian@perix.co.uk>
date Fri, 08 Mar 2019 23:45:12 +0000
parents 9a8c7c17d816
children a98dabdb5a7b
files hgext/phabricator.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/phabricator.py	Fri Mar 08 23:48:49 2019 +0000
+++ b/hgext/phabricator.py	Fri Mar 08 23:45:12 2019 +0000
@@ -161,7 +161,8 @@
     def process(prefix, obj):
         if isinstance(obj, bool):
             obj = {True: b'true', False: b'false'}[obj]  # Python -> PHP form
-        items = {list: enumerate, dict: lambda x: x.items()}.get(type(obj))
+        lister = lambda l: [(b'%d' % k, v) for k, v in enumerate(l)]
+        items = {list: lister, dict: lambda x: x.items()}.get(type(obj))
         if items is None:
             flatparams[prefix] = obj
         else: