changeset 32846:526f9f12f707

formatter: close raw template file explicitly
author Yuya Nishihara <yuya@tcha.org>
date Sat, 06 May 2017 14:40:22 +0900
parents 3abba5bc3454
children 8016fe56a29e
files mercurial/formatter.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/formatter.py	Tue Jun 13 17:43:33 2017 -0400
+++ b/mercurial/formatter.py	Sat May 06 14:40:22 2017 +0900
@@ -399,7 +399,8 @@
         # is it a mapfile for a style?
         if os.path.basename(tmpl).startswith("map-"):
             return None, os.path.realpath(tmpl)
-        tmpl = open(tmpl).read()
+        with open(tmpl) as f:
+            tmpl = f.read()
         return tmpl, None
 
     # constant string?