##// END OF EJS Templates
Merge pull request #2092 from bfroehle/prun_print_stats...
Min RK -
r7959:965fc650 merge
parent child Browse files
Show More
@@ -226,20 +226,12 b' python-profiler package from non-free.""")'
226
226
227 # Trap output.
227 # Trap output.
228 stdout_trap = StringIO()
228 stdout_trap = StringIO()
229
229 stats_stream = stats.stream
230 if hasattr(stats,'stream'):
230 try:
231 # In newer versions of python, the stats object has a 'stream'
232 # attribute to write into.
233 stats.stream = stdout_trap
231 stats.stream = stdout_trap
234 stats.print_stats(*lims)
232 stats.print_stats(*lims)
235 else:
233 finally:
236 # For older versions, we manually redirect stdout during printing
234 stats.stream = stats_stream
237 sys_stdout = sys.stdout
238 try:
239 sys.stdout = stdout_trap
240 stats.print_stats(*lims)
241 finally:
242 sys.stdout = sys_stdout
243
235
244 output = stdout_trap.getvalue()
236 output = stdout_trap.getvalue()
245 output = output.rstrip()
237 output = output.rstrip()
General Comments 0
You need to be logged in to leave comments. Login now