diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-12 00:43:29 +0000 |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2007-08-12 00:43:29 +0000 |
commit | 48a31a022c39e3ed194329b949d19e014a48f1d9 (patch) | |
tree | 18afcc1017c9bf5f45abaec602b533ffdf5d4701 /Lib/profile.py | |
parent | 1e156520ff8c4e9f69d9252a2426d319a1cc356c (diff) | |
download | cpython-48a31a022c39e3ed194329b949d19e014a48f1d9.tar.gz |
Kill execfile(), use exec() instead
Diffstat (limited to 'Lib/profile.py')
-rwxr-xr-x | Lib/profile.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/profile.py b/Lib/profile.py index 55118b5960..cdc247911b 100755 --- a/Lib/profile.py +++ b/Lib/profile.py @@ -609,7 +609,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 |