contrib/check-code.py
changeset 29144 f8b87a779c87
parent 29143 8ed693ec5398
child 29145 c641b8dfb98c
--- 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: