Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

[scope][leak] Fix config file descriptor leak. #524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion torcharrow/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def __init__(self, config: ty.Union[dict, str, None] = None):
self.config = type(self).default_config
elif isinstance(config, str):
path = config
self.config = {**type(self).default_config, **json.load(open(path))}
with open(path) as f:
self.config = {**type(self).default_config, **json.load(f)}
elif isinstance(config, dict):
self.config = {**type(self).default_config, **config}

Expand Down