Skip to content

Updater: unclosed file object #1099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jku opened this issue Aug 5, 2020 · 2 comments
Closed

Updater: unclosed file object #1099

jku opened this issue Aug 5, 2020 · 2 comments
Labels
good first issue Bite-sized items for first time contributors

Comments

@jku
Copy link
Member

jku commented Aug 5, 2020

file_object in Updater._get_metadata_file() is left unclosed whenever an exception is raised (when the metadata fails a check of any kind). There are loads of examples in the test suite, e.g.

python3 test_updater.py TestUpdater.test_3__update_metadata

will complain "ResourceWarning: unclosed file"

This is not very dangerous but makes it hard to find actual issues in test output (try running all test_updater.py tests). There may be other sources of this warning but the vast number of warnings from this one make it difficult to find them.

@joshuagl
Copy link
Member

joshuagl commented Aug 7, 2020

Seems like a good place to use finally as a clean up handler.

@joshuagl joshuagl added the good first issue Bite-sized items for first time contributors label Aug 7, 2020
@joshuagl
Copy link
Member

Fixed in #1147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Bite-sized items for first time contributors
Projects
None yet
Development

No branches or pull requests

2 participants