summaryrefslogtreecommitdiffstats
path: root/Tools
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 /Tools
parent41eaedd3613cebc83e6b9925499369992c7a7770 (diff)
downloadcpython-016880229a369a3fb419f3eed28b6db7c342fe71.zip
cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.gz
cpython-016880229a369a3fb419f3eed28b6db7c342fe71.tar.bz2
Kill execfile(), use exec() instead
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/hotshotmain.py7
-rw-r--r--Tools/versioncheck/README2
-rw-r--r--Tools/versioncheck/checkversions.py2
3 files changed, 8 insertions, 3 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")
diff --git a/Tools/versioncheck/README b/Tools/versioncheck/README
index a51411b..1dd2eca 100644
--- a/Tools/versioncheck/README
+++ b/Tools/versioncheck/README
@@ -19,7 +19,7 @@ your distribution. In stead of a single URL you can also specify a list
of URLs. Each of these will be checked in order until one is available,
this is handy for distributions that live in multiple places. Put the
primary distribution site (the most up-to-date site) before others.
-The script is executed with execfile(), not imported, and the current
+The script is read and executed with exec(), not imported, and the current
directory is the checkversion directory, so be careful with globals,
importing, etc.
diff --git a/Tools/versioncheck/checkversions.py b/Tools/versioncheck/checkversions.py
index 27c16e7..ccb544d 100644
--- a/Tools/versioncheck/checkversions.py
+++ b/Tools/versioncheck/checkversions.py
@@ -26,7 +26,7 @@ def check1dir(dummy, dir, files):
if CHECKNAME in files:
fullname = os.path.join(dir, CHECKNAME)
try:
- execfile(fullname)
+ exec(open(fullname).read())
except:
print('** Exception in', fullname)