Skip to content

Commit

Permalink
fix: web.profile behavior in python 2.5 (Bug#133080)
Browse files Browse the repository at this point in the history
  • Loading branch information
anandology committed Dec 24, 2007
1 parent be46bf1 commit 90433b7
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions web/utils.py
Expand Up @@ -624,14 +624,18 @@ def __call__(self, *args): ##, **kw): kw unused
stime = time.time() stime = time.time()
result = prof.runcall(self.func, *args) result = prof.runcall(self.func, *args)
stime = time.time() - stime stime = time.time() - stime

prof.close() prof.close()
stats = hotshot.stats.load(temp.name)
stats.strip_dirs() def print_stats():
stats.sort_stats('time', 'calls') stats = hotshot.stats.load(temp.name)
stats.strip_dirs()
stats.sort_stats('time', 'calls')
stats.print_stats(40)
stats.print_callers()

x = '\n\ntook '+ str(stime) + ' seconds\n' x = '\n\ntook '+ str(stime) + ' seconds\n'
x += capturestdout(stats.print_stats)(40) x += capturestdout(print_stats)()
x += capturestdout(stats.print_callers)()
return result, x return result, x


profile = Profile profile = Profile
Expand Down

0 comments on commit 90433b7

Please sign in to comment.