Skip to content

Commit

Permalink
Merge pull request #333 from wolfmanstout/fix_file_open_leak
Browse files Browse the repository at this point in the history
Fix leak of file open() without close.
  • Loading branch information
drmfinlay committed Apr 25, 2021
2 parents 82e1e3e + 96dec89 commit 4b47603
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dragonfly/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ def load_from_file(self, path):
section.update_namespace(namespace)

try:
exec(compile(open(path).read(), path, 'exec'), namespace)
with open(path) as file:
exec(compile(file.read(), path, 'exec'), namespace)
# except ConfigError, e:
except Exception as e:
print("exception:", e)
Expand Down

0 comments on commit 4b47603

Please sign in to comment.