Skip to content

Fix file handle leaks in config.py (use context managers)#35

Open
PrasannaPal21 wants to merge 1 commit intohpc-io:masterfrom
PrasannaPal21:config-file-handle-leaks
Open

Fix file handle leaks in config.py (use context managers)#35
PrasannaPal21 wants to merge 1 commit intohpc-io:masterfrom
PrasannaPal21:config-file-handle-leaks

Conversation

@PrasannaPal21
Copy link

Use context managers when opening JSON config files so file handles are always closed, and specify UTF-8 encoding for consistent behavior across platforms.

Previously, file handles were never closed, which can leak resources and is poor practice.
with open(...) ensures the file is closed even on exceptions.
and encoding='utf-8' matches JSON and avoids platform-dependent default encodings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant