Patchwork D6105: py3: convert indexes into bytes when enumerating lists in urlencodenested

login
register
mail settings
Submitter phabricator
Date March 10, 2019, 1:50 a.m.
Message ID <ed07d68a76969eb482797f5cca9f3fbc@localhost.localdomain>
Download mbox | patch
Permalink /patch/39172/
State Not Applicable
Headers show

Comments

phabricator - March 10, 2019, 1:50 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG47125193bad0: py3: convert indexes into bytes when enumerating lists in urlencodenested (authored by Kwan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6105?vs=14418&id=14431

REVISION DETAIL
  https://phab.mercurial-scm.org/D6105

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: Kwan, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -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: