Skip to content

Commit

Permalink
Close resource_stream file pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Dec 27, 2020
1 parent 32025c7 commit 3a47800
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app_enabler/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def load_addon(module_name: str) -> Optional[Dict[str, Any]]:
:return: addon configuration
"""
try:
fp = resource_stream(module_name, "addon.json")
return json.load(fp)
with resource_stream(module_name, "addon.json") as fp:
data = json.load(fp)
return data
except Exception:
pass

Expand Down
1 change: 1 addition & 0 deletions changes/19.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Close resource_stream file pointer

0 comments on commit 3a47800

Please sign in to comment.