# HG changeset patch # User timeless # Date 1462931079 0 # Node ID f8b87a779c87586aa043bcd6030369715edfc9c1 # Parent 8ed693ec5398324c5147ec2ff10a7219d6bde493 check-code: switch to opener diff -r 8ed693ec5398 -r f8b87a779c87 contrib/check-code.py --- 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: