Permalink
Browse files

fix: web.profile behavior in python 2.5 (Bug#133080)

  • Loading branch information...
1 parent be46bf1 commit 90433b744a0c2cf405642cf6f22e81fbf4e5d72d @anandology anandology committed Dec 24, 2007
Showing with 10 additions and 6 deletions.
  1. +10 −6 web/utils.py
View
16 web/utils.py
@@ -624,14 +624,18 @@ def __call__(self, *args): ##, **kw): kw unused
stime = time.time()
result = prof.runcall(self.func, *args)
stime = time.time() - stime
-
prof.close()
- stats = hotshot.stats.load(temp.name)
- stats.strip_dirs()
- stats.sort_stats('time', 'calls')
+
+ def print_stats():
+ 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 += capturestdout(stats.print_stats)(40)
- x += capturestdout(stats.print_callers)()
+ x += capturestdout(print_stats)()
+
return result, x
profile = Profile

0 comments on commit 90433b7

Please sign in to comment.