mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Kill execfile(), use exec() instead
This commit is contained in:
parent
41eaedd361
commit
016880229a
98 changed files with 179 additions and 341 deletions
|
@ -23,7 +23,12 @@ def run_hotshot(filename, profile, args):
|
|||
prof = hotshot.Profile(profile)
|
||||
sys.path.insert(0, os.path.dirname(filename))
|
||||
sys.argv = [filename] + args
|
||||
prof.run("execfile(%r)" % filename)
|
||||
fp = open(filename)
|
||||
try:
|
||||
script = fp.read()
|
||||
finally:
|
||||
fp.close()
|
||||
prof.run("exec(%r)" % script)
|
||||
prof.close()
|
||||
stats = hotshot.stats.load(profile)
|
||||
stats.sort_stats("time", "calls")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue