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

login
register
mail settings
Submitter Pulkit Goyal
Date March 16, 2017, 4:13 a.m.
Message ID <1fc3d1f02865b105d25e.1489637596@pulkit-goyal>
Download mbox | patch
Permalink /patch/19374/
State Accepted
Headers show

Comments

Pulkit Goyal - March 16, 2017, 4:13 a.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@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.

Patch

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):