debug.profile: support kwargs and ret values

This commit is contained in:
Vassilii Khachaturov 2014-02-16 13:52:05 +02:00
parent 6c2d18f807
commit ad812c8537

View File

@ -33,12 +33,12 @@ from __future__ import print_function
# Debugging utilities
#
#-------------------------------------------------------------------------
def profile(func, *args):
def profile(func, *args, **kwargs):
import hotshot.stats
prf = hotshot.Profile('mystats.profile')
print("Start")
prf.runcall(func, *args)
r = prf.runcall(func, *args, **kwargs)
print("Finished")
prf.close()
print("Loading profile")
@ -48,6 +48,7 @@ def profile(func, *args):
stats.sort_stats('time', 'calls')
stats.print_stats(100)
stats.print_callers(100)
return r
def format_exception(tb_type=None, tb_value=None, tb=None):
"""