[PATCH 1 of 6 py3] scmutil: make function name bytes in class filecache

Pulkit Goyal 7895pulkit at gmail.com
Thu Mar 16 00:13:16 EDT 2017


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1489626153 -19800
#      Thu Mar 16 06:32:33 2017 +0530
# Node ID 1fc3d1f02865b105d25ec6d51148dd7a0745e3cf
# Parent  fb1b5cd17664218f73ed6ba604973b817932593e
scmutil: make function name bytes in class filecache

func.__name__ returns unicodes and this leads to keyerror when we try
to do filecache[''] by passing bytes.

diff -r fb1b5cd17664 -r 1fc3d1f02865 mercurial/scmutil.py
--- a/mercurial/scmutil.py	Wed Mar 15 00:27:17 2017 -0700
+++ b/mercurial/scmutil.py	Thu Mar 16 06:32:33 2017 +0530
@@ -885,7 +885,7 @@
 
     def __call__(self, func):
         self.func = func
-        self.name = func.__name__
+        self.name = func.__name__.encode('ascii')
         return self
 
     def __get__(self, obj, type=None):


More information about the Mercurial-devel mailing list