Skip to content
Snippets Groups Projects
Commit cc458674 authored by Yuya Nishihara's avatar Yuya Nishihara
Browse files

statprof: fix overflow while skipping boilerplate parts

I got IndexError randomly because of stack[i] where i = len(stack).
parent fc4c598d
No related branches found
No related tags found
No related merge requests found
......@@ -257,6 +257,9 @@
def filename(self):
return os.path.basename(self.path)
def skipname(self):
return r'%s:%s' % (self.filename(), self.function)
class Sample(object):
__slots__ = (u'stack', u'time')
......@@ -661,6 +664,5 @@
if len(stack) > 1:
i = 1
# Skip boiler plate parts of the stack
name = r'%s:%s' % (stack[i].filename(), stack[i].function)
while i < len(stack) and name in skips:
while i < len(stack) and stack[i].skipname() in skips:
i += 1
......@@ -666,5 +668,4 @@
i += 1
name = r'%s:%s' % (stack[i].filename(), stack[i].function)
if i < len(stack):
child.add(stack[i:], time)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment