changeset 29144:f8b87a779c87

check-code: switch to opener
author timeless <timeless@mozdev.org>
date Wed, 11 May 2016 01:44:39 +0000
parents 8ed693ec5398
children c641b8dfb98c
files contrib/check-code.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Wed May 11 01:39:07 2016 +0000
+++ b/contrib/check-code.py	Wed May 11 01:44:39 2016 +0000
@@ -491,12 +491,11 @@
     result = True
 
     try:
-        fp = open(f)
+        with open(f) as fp:
+            pre = post = fp.read()
     except IOError as e:
         print("Skipping %s, %s" % (f, str(e).split(':', 1)[0]))
         return result
-    pre = post = fp.read()
-    fp.close()
 
     for name, match, magic, filters, pats in checks:
         if debug: