@@ -25,12 +25,12 @@ def profile(statement, globals_, locals_):
2525 except SystemExit :
2626 pass
2727 profile_ .create_stats ()
28- profile_result = marshal .dumps (self .stats , f )
28+ profile_result = marshal .dumps (profile_ .stats )
2929 return profile_result
3030
3131
3232def profile_expression (expression , globals_ , locals_ ):
33- profile_result = profile ('result = %s' % expression , globals (), locals () )
33+ profile_result = profile ('result = %s' % expression , globals_ , locals_ )
3434 return (locals ()['result' ], profile_result )
3535
3636
@@ -98,15 +98,9 @@ def inner(function_, *args, **kwargs):
9898 'decorated_function.original_function(*args, **kwargs)' ,
9999 globals (), locals ()
100100 )
101-
102-
103- profile_handler = \
104- profile_handling .get_profile_handler (profile_handler )
105-
106- profile_handler (profile_result )
107-
108- Z Z Z Do shit depending on `profile_handler` . Allow filename , folder , email address , or index for printing (sort ). In any case do everything on a thread .
109101
102+ decorated_function .profile_handler (profile_result )
103+
110104 return result
111105
112106 else : # decorated_function.profiling_on is False
@@ -119,7 +113,8 @@ def inner(function_, *args, **kwargs):
119113 decorated_function .profiling_on = None
120114 decorated_function .condition = condition
121115 decorated_function .off_after = off_after
122- decorated_function .sort = sort
116+ decorated_function .profile_handler = \
117+ profile_handling .get_profile_handler (profile_handler )
123118
124119 return decorated_function
125120
0 commit comments