summaryrefslogtreecommitdiff
path: root/sphinx/jinja2glue.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/jinja2glue.py')
-rw-r--r--sphinx/jinja2glue.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py
index f3ce87a8c..c5e0e29e5 100644
--- a/sphinx/jinja2glue.py
+++ b/sphinx/jinja2glue.py
@@ -70,10 +70,8 @@ class SphinxFileSystemLoader(FileSystemLoader):
f = open_if_exists(filename)
if f is None:
continue
- try:
+ with f:
contents = f.read().decode(self.encoding)
- finally:
- f.close()
mtime = path.getmtime(filename)