py3: use unicodes in __slots__
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 30 Nov 2016 23:38:50 +0530
changeset 30568 bb35fe8621f5
parent 30567 73ce055b169a
child 30569 bcb858396233
py3: use unicodes in __slots__ __slots__ in Python 3 accepts only unicodes and there is no harm using unicodes in __slots__. So just adding u'' is fine. Previous occurences of this problem are treated the same way.
mercurial/statprof.py
tests/test-check-py3-compat.t
--- a/mercurial/statprof.py	Mon Nov 21 08:09:41 2016 -0800
+++ b/mercurial/statprof.py	Wed Nov 30 23:38:50 2016 +0530
@@ -177,7 +177,7 @@
 class CodeSite(object):
     cache = {}
 
-    __slots__ = ('path', 'lineno', 'function', 'source')
+    __slots__ = (u'path', u'lineno', u'function', u'source')
 
     def __init__(self, path, lineno, function):
         self.path = path
@@ -232,7 +232,7 @@
         return os.path.basename(self.path)
 
 class Sample(object):
-    __slots__ = ('stack', 'time')
+    __slots__ = (u'stack', u'time')
 
     def __init__(self, stack, time):
         self.stack = stack
--- a/tests/test-check-py3-compat.t	Mon Nov 21 08:09:41 2016 -0800
+++ b/tests/test-check-py3-compat.t	Wed Nov 30 23:38:50 2016 +0530
@@ -36,7 +36,6 @@
   mercurial/cffi/mpatch.py: error importing: <ImportError> No module named 'mercurial.cffi' (error at check-py3-compat.py:*)
   mercurial/cffi/osutil.py: error importing: <ImportError> No module named 'mercurial.cffi' (error at check-py3-compat.py:*)
   mercurial/scmwindows.py: error importing: <ImportError> No module named 'msvcrt' (error at win32.py:*)
-  mercurial/statprof.py: error importing: <TypeError> __slots__ items must be strings, not 'bytes' (error at statprof.py:*)
   mercurial/win32.py: error importing: <ImportError> No module named 'msvcrt' (error at win32.py:*)
   mercurial/windows.py: error importing: <ImportError> No module named 'msvcrt' (error at windows.py:*)