Mercurial > public > mercurial-scm > hg-stable
diff contrib/check-code.py @ 13400:14f3795a5ed7
explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Fri, 24 Dec 2010 15:23:01 +0100 |
parents | 4b07578967e6 |
children | 43b3b761d9d1 |
line wrap: on
line diff
--- a/contrib/check-code.py Fri Feb 11 22:24:10 2011 +0800 +++ b/contrib/check-code.py Fri Dec 24 15:23:01 2010 +0100 @@ -248,7 +248,9 @@ fc = 0 if not re.match(match, f): continue - pre = post = open(f).read() + fp = open(f) + pre = post = fp.read() + fp.close() if "no-" + "check-code" in pre: break for p, r in filters: