summaryrefslogtreecommitdiffstats
path: root/Lib/cProfile.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-08-12 00:43:29 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-08-12 00:43:29 (GMT)
commit016880229a369a3fb419f3eed28b6db7c342fe71 (patch)
tree9b11de5c197bc556dd515e035327673765cd4871 /Lib/cProfile.py
parent41eaedd3613cebc83e6b9925499369992c7a7770 (diff)
downloadcpython-016880229a369a3fb419f3eed28b6db7c342fe71.zip
cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.gz
cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.bz2
Kill execfile(), use exec() instead
Diffstat (limited to 'Lib/cProfile.py')
-rwxr-xr-xLib/cProfile.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/cProfile.py b/Lib/cProfile.py
index d10b7ab..ae16277 100755
--- a/Lib/cProfile.py
+++ b/Lib/cProfile.py
@@ -180,7 +180,12 @@ def main():
if (len(sys.argv) > 0):
sys.path.insert(0, os.path.dirname(sys.argv[0]))
- run('execfile(%r)' % (sys.argv[0],), options.outfile, options.sort)
+ fp = open(sys.argv[0])
+ try:
+ script = fp.read()
+ finally:
+ fp.close()
+ run('exec(%r)' % script, options.outfile, options.sort)
else:
parser.print_usage()
return parser