py3: ensure that we don't concat bytes and str and the end result is bytes
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 01 Jun 2017 01:41:34 +0530
changeset 32614 4b426ae96ff2
parent 32613 e7eb7494e98d
child 32615 c9318beb7c1a
py3: ensure that we don't concat bytes and str and the end result is bytes Here obj.__module__ and obj.__name__ are str. Either we can convert them to bytes or use an r'' and convert back to bytes when concat is done. I preferred the later one since we are encoding only once here.
mercurial/hook.py
--- a/mercurial/hook.py	Thu Jun 01 00:00:10 2017 +0530
+++ b/mercurial/hook.py	Thu Jun 01 01:41:34 2017 +0530
@@ -31,7 +31,7 @@
 
     if callable(funcname):
         obj = funcname
-        funcname = obj.__module__ + "." + obj.__name__
+        funcname = pycompat.sysbytes(obj.__module__ + r"." + obj.__name__)
     else:
         d = funcname.rfind('.')
         if d == -1: