commit | 016880229a369a3fb419f3eed28b6db7c342fe71 | [log] [tgz] |
---|---|---|
author | Neal Norwitz <nnorwitz@gmail.com> | Sun Aug 12 00:43:29 2007 +0000 |
committer | Neal Norwitz <nnorwitz@gmail.com> | Sun Aug 12 00:43:29 2007 +0000 |
tree | 9b11de5c197bc556dd515e035327673765cd4871 | |
parent | 41eaedd3613cebc83e6b9925499369992c7a7770 [diff] [blame] |
Kill execfile(), use exec() instead
diff --git a/Lib/profile.py b/Lib/profile.py index 55118b5..cdc2479 100755 --- a/Lib/profile.py +++ b/Lib/profile.py
@@ -609,7 +609,12 @@ 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