Massive changes from SF 589982 (tempfile.py rewrite, by Zack
Weinberg). This changes all uses of deprecated tempfile functions to
the recommended ones.
diff --git a/Lib/hotshot/stones.py b/Lib/hotshot/stones.py
index 5a029d5..e171fbc 100644
--- a/Lib/hotshot/stones.py
+++ b/Lib/hotshot/stones.py
@@ -8,12 +8,10 @@
if sys.argv[1:]:
logfile = sys.argv[1]
- cleanup = 0
else:
import tempfile
- logfile = tempfile.mktemp()
- cleanup = 1
-
+ logf = tempfile.NamedTemporaryFile()
+ logfile = logf.name
p = hotshot.Profile(logfile)
benchtime, stones = p.runcall(test.pystone.pystones)
@@ -24,8 +22,6 @@
print "This machine benchmarks at %g pystones/second" % stones
stats = hotshot.stats.load(logfile)
-if cleanup:
- os.unlink(logfile)
stats.strip_dirs()
stats.sort_stats('time', 'calls')
try: