diff options
Diffstat (limited to 'sphinx/jinja2glue.py')
-rw-r--r-- | sphinx/jinja2glue.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py index df1aa490c..6e2ef7186 100644 --- a/sphinx/jinja2glue.py +++ b/sphinx/jinja2glue.py @@ -91,10 +91,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) |