Skip to content

Explicitly close files to prevent resource leak#132

Open
Stephen0512 wants to merge 1 commit into
apimatic:mainfrom
Stephen0512:main
Open

Explicitly close files to prevent resource leak#132
Stephen0512 wants to merge 1 commit into
apimatic:mainfrom
Stephen0512:main

Conversation

@Stephen0512

Copy link
Copy Markdown

What

This pull request fixes a file-handling issue in the tests.

Why

The current implementation uses open() without explicitly closing the file, which can potentially lead to resource leaks. While Python's garbage collector will eventually close the file once it is no longer referenced, it is generally better practice to explicitly close files or use a context manager.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause a breaking change)
  • Tests (adds or updates tests)
  • Documentation (adds or updates documentation)
  • Refactor (style improvements, performance improvements, code refactoring)
  • Revert (reverts a commit)
  • CI/Build (adds or updates a script, change in external dependencies)

Testing

Rerun the existing test suites.

Checklist

  • My code follows the coding conventions
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added new unit tests

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