mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
change return values of simple run* functions
This commit is contained in:
parent
8460b94b50
commit
6cb84f3cde
1 changed files with 3 additions and 4 deletions
|
|
@ -396,8 +396,7 @@ class Profile:
|
||||||
def run(self, cmd):
|
def run(self, cmd):
|
||||||
import __main__
|
import __main__
|
||||||
dict = __main__.__dict__
|
dict = __main__.__dict__
|
||||||
self.runctx(cmd, dict, dict)
|
return self.runctx(cmd, dict, dict)
|
||||||
return self
|
|
||||||
|
|
||||||
def runctx(self, cmd, globals, locals):
|
def runctx(self, cmd, globals, locals):
|
||||||
self.set_cmd(cmd)
|
self.set_cmd(cmd)
|
||||||
|
|
@ -406,16 +405,16 @@ class Profile:
|
||||||
exec cmd in globals, locals
|
exec cmd in globals, locals
|
||||||
finally:
|
finally:
|
||||||
sys.setprofile(None)
|
sys.setprofile(None)
|
||||||
|
return self
|
||||||
|
|
||||||
# This method is more useful to profile a single function call.
|
# This method is more useful to profile a single function call.
|
||||||
def runcall(self, func, *args):
|
def runcall(self, func, *args):
|
||||||
self.set_cmd(`func`)
|
self.set_cmd(`func`)
|
||||||
sys.setprofile(self.dispatcher)
|
sys.setprofile(self.dispatcher)
|
||||||
try:
|
try:
|
||||||
apply(func, args)
|
return apply(func, args)
|
||||||
finally:
|
finally:
|
||||||
sys.setprofile(None)
|
sys.setprofile(None)
|
||||||
return self
|
|
||||||
|
|
||||||
|
|
||||||
#******************************************************************
|
#******************************************************************
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue