##// END OF EJS Templates
profile: prevent a crash when line number is unknown...
marmoute -
r50473:aab3d4c0 stable
parent child Browse files
Show More
@@ -236,8 +236,8 b' class CodeSite:'
236
236
237 def getsource(self, length):
237 def getsource(self, length):
238 if self.source is None:
238 if self.source is None:
239 lineno = self.lineno - 1
240 try:
239 try:
240 lineno = self.lineno - 1 # lineno can be None
241 with open(self.path, b'rb') as fp:
241 with open(self.path, b'rb') as fp:
242 for i, line in enumerate(fp):
242 for i, line in enumerate(fp):
243 if i == lineno:
243 if i == lineno:
@@ -773,7 +773,7 b' def display_hotpath(data, fp, limit=0.05'
773 codestring = codepattern % (
773 codestring = codepattern % (
774 prefix,
774 prefix,
775 b'line'.rjust(spacing_len),
775 b'line'.rjust(spacing_len),
776 site.lineno,
776 site.lineno if site.lineno is not None else -1,
777 b''.ljust(max(0, 4 - len(str(site.lineno)))),
777 b''.ljust(max(0, 4 - len(str(site.lineno)))),
778 site.getsource(30),
778 site.getsource(30),
779 )
779 )
General Comments 0
You need to be logged in to leave comments. Login now