Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12ac3e1

Browse files
committed
Using repr() generates entries that the current stats package can't
collate, so setting it back to the function name
1 parent b102764 commit 12ac3e1

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

Lib/profile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def trace_dispatch(self, frame, event, arg):
216216
t = t[0] + t[1] - self.t - self.bias
217217

218218
if event == "c_call":
219-
self.c_func_name = repr(arg)
219+
self.c_func_name = arg.__name__
220220

221221
if self.dispatch[event](self, frame,t):
222222
t = timer()
@@ -233,7 +233,7 @@ def trace_dispatch_i(self, frame, event, arg):
233233
t = timer() - self.t - self.bias
234234

235235
if event == "c_call":
236-
self.c_func_name = repr(arg)
236+
self.c_func_name = arg.__name__
237237

238238
if self.dispatch[event](self, frame, t):
239239
self.t = timer()
@@ -248,7 +248,7 @@ def trace_dispatch_mac(self, frame, event, arg):
248248
t = timer()/60.0 - self.t - self.bias
249249

250250
if event == "c_call":
251-
self.c_func_name = repr(arg)
251+
self.c_func_name = arg.__name__
252252

253253
if self.dispatch[event](self, frame, t):
254254
self.t = timer()/60.0
@@ -262,7 +262,7 @@ def trace_dispatch_l(self, frame, event, arg):
262262
t = get_time() - self.t - self.bias
263263

264264
if event == "c_call":
265-
self.c_func_name = repr(arg)
265+
self.c_func_name = arg.__name__
266266

267267
if self.dispatch[event](self, frame, t):
268268
self.t = get_time()

Lib/test/output/test_profile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ test_profile
44
Ordered by: standard name
55

66
ncalls tottime percall cumtime percall filename:lineno(function)
7-
12 0.000 0.000 0.012 0.001 :0(<built-in function hasattr>)
8-
8 0.000 0.000 0.000 0.000 :0(<built-in function range>)
9-
1 0.000 0.000 0.000 0.000 :0(<built-in function setprofile>)
7+
12 0.000 0.000 0.012 0.001 :0(hasattr)
8+
8 0.000 0.000 0.000 0.000 :0(range)
9+
1 0.000 0.000 0.000 0.000 :0(setprofile)
1010
1 0.000 0.000 1.000 1.000 <string>:1(?)
1111
0 0.000 0.000 profile:0(profiler)
1212
1 0.000 0.000 1.000 1.000 profile:0(testfunc())

0 commit comments

Comments
 (0)