[pypy-commit] benchmarks default: use the with statement

pjenvey noreply at buildbot.pypy.org
Fri May 3 00:58:59 CEST 2013


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: 
Changeset: r213:235ea28d5947
Date: 2013-05-02 15:58 -0700
http://bitbucket.org/pypy/benchmarks/changeset/235ea28d5947/

Log:	use the with statement

diff --git a/runner.py b/runner.py
--- a/runner.py
+++ b/runner.py
@@ -275,11 +275,9 @@
                 bm_file = open(options.benchmarks_file, 'rt')
             except IOError as e:
                 parser.error('error opening benchmarks file: %s' % e)
-            try:
+            with bm_file:
                 for line in bm_file:
                     benchmarks.append(line.strip())
-            finally:
-                bm_file.close()
         else:
             benchmarks = list(BENCHMARK_SET)
 


More information about the pypy-commit mailing list