diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-12 00:43:29 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-12 00:43:29 (GMT) |
commit | 016880229a369a3fb419f3eed28b6db7c342fe71 (patch) | |
tree | 9b11de5c197bc556dd515e035327673765cd4871 /Tools/scripts | |
parent | 41eaedd3613cebc83e6b9925499369992c7a7770 (diff) | |
download | cpython-016880229a369a3fb419f3eed28b6db7c342fe71.zip cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.gz cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.bz2 |
Kill execfile(), use exec() instead
Diffstat (limited to 'Tools/scripts')
-rw-r--r-- | Tools/scripts/hotshotmain.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Tools/scripts/hotshotmain.py b/Tools/scripts/hotshotmain.py index 4f40628..7e39d98 100644 --- a/Tools/scripts/hotshotmain.py +++ b/Tools/scripts/hotshotmain.py @@ -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") |