Skip to content

Commit 2a1a56e

Browse files
committed
fix bugs; incorporate python#9928
1 parent ae1120a commit 2a1a56e

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Lib/cProfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# ____________________________________________________________
1313
# Simple interface
1414

15-
def run(statement, filename=None, sort=-1):
15+
def run(statement, filename=None, sort=-1, numresults=None):
1616
return _pyprofile._Utils(Profile).run(statement, filename, sort,
1717
numresults)
1818

Lib/profile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def run(statement, filename=None, sort=-1, numresults=None):
8888
standard name string (file/line/function-name) that is presented in
8989
each line.
9090
"""
91-
return _Utils(Profile).run(statement, filename, sort)
91+
return _Utils(Profile).run(statement, filename, sort, numresults)
9292

9393
def runctx(statement, globals, locals, filename=None, sort=-1,
9494
numresults=None):

Lib/pstats.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,10 @@ def compare (self, left, right):
492492

493493
def func_strip_path(func_name):
494494
filename, line, name = func_name
495-
return os.path.basename(filename), line, name
495+
path, base_name = os.path.split(filename)
496+
if base_name.startswith('__'):
497+
base_name = os.path.join(os.path.basename(path), base_name)
498+
return base_name, line, name
496499

497500
def func_get_function_name(func):
498501
return func[2]
@@ -509,7 +512,7 @@ def func_std_string(func_name): # match what old profile produced
509512
return "%s:%d(%s)" % func_name
510513

511514
#**************************************************************************
512-
# The following functions combine statists for pairs functions.
515+
# The following functions combine statistics for pairs functions.
513516
# The bulk of the processing involves correctly handling "call" lists,
514517
# such as callers and callees.
515518
#**************************************************************************

0 commit comments

Comments
 (0)