##// END OF EJS Templates
py3: use sysbytes for converting code attributes...
Gregory Szorc -
r40231:720355c7 default
parent child Browse files
Show More
@@ -12,12 +12,17 b' of the GNU General Public License, incor'
12
12
13 from __future__ import absolute_import
13 from __future__ import absolute_import
14
14
15 from . import (
16 pycompat,
17 )
18
15 def label(code):
19 def label(code):
16 if isinstance(code, str):
20 if isinstance(code, str):
17 return '~' + code # built-in functions ('~' sorts at the end)
21 # built-in functions ('~' sorts at the end)
22 return '~' + pycompat.sysbytes(code)
18 else:
23 else:
19 return '%s %s:%d' % (code.co_name,
24 return '%s %s:%d' % (pycompat.sysbytes(code.co_name),
20 code.co_filename,
25 pycompat.sysbytes(code.co_filename),
21 code.co_firstlineno)
26 code.co_firstlineno)
22
27
23 class KCacheGrind(object):
28 class KCacheGrind(object):
@@ -46,7 +51,7 b' class KCacheGrind(object):'
46 if isinstance(code, str):
51 if isinstance(code, str):
47 out_file.write(b'fi=~\n')
52 out_file.write(b'fi=~\n')
48 else:
53 else:
49 out_file.write(b'fi=%s\n' % code.co_filename)
54 out_file.write(b'fi=%s\n' % pycompat.sysbytes(code.co_filename))
50
55
51 out_file.write(b'fn=%s\n' % label(code))
56 out_file.write(b'fn=%s\n' % label(code))
52
57
@@ -80,7 +85,7 b' class KCacheGrind(object):'
80 out_file.write(b'cfi=~\n')
85 out_file.write(b'cfi=~\n')
81 out_file.write(b'calls=%d 0\n' % subentry.callcount)
86 out_file.write(b'calls=%d 0\n' % subentry.callcount)
82 else:
87 else:
83 out_file.write(b'cfi=%s\n' % code.co_filename)
88 out_file.write(b'cfi=%s\n' % pycompat.sysbytes(code.co_filename))
84 out_file.write(b'calls=%d %d\n' % (
89 out_file.write(b'calls=%d %d\n' % (
85 subentry.callcount, code.co_firstlineno))
90 subentry.callcount, code.co_firstlineno))
86
91
General Comments 0
You need to be logged in to leave comments. Login now