changeset 34727:a652b7763f66

peer: when collecting method names for batch calls, bytes-ify __name__ This will explode violently if we have a non-ascii command name. That shouldn't ever happen in core, and seems unlikely even in third-party code. Regardless, it'll explode violently, so we can revisit things in the future if we need to change the encoding here. Differential Revision: https://phab.mercurial-scm.org/D1092
author Augie Fackler <augie@google.com>
date Sat, 14 Oct 2017 12:03:42 -0400
parents daf12f69699f
children 09397d0dd3b7
files mercurial/peer.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/peer.py	Sat Oct 14 12:02:15 2017 -0400
+++ b/mercurial/peer.py	Sat Oct 14 12:03:42 2017 -0400
@@ -34,7 +34,9 @@
     def __getattr__(self, name):
         def call(*args, **opts):
             resref = future()
-            self.calls.append((name, args, opts, resref,))
+            # Please don't invent non-ascii method names, or you will
+            # give core hg a very sad time.
+            self.calls.append((name.encode('ascii'), args, opts, resref,))
             return resref
         return call
     def submit(self):