Skip to content
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

Stop closing files opened by the caller #165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jackriccomini
Copy link

@jackriccomini jackriccomini commented Jan 17, 2025

Fixes #164

Note: this was a very quick edit on a Friday afternoon before I log off for the week.

I have only run through a test in the case that the file is passed in (fh_is_managed = True), not in the other case (fh_is_managed = False).

Please do make changes if needed

@addisonElliott
Copy link
Collaborator

Yep, this looks good. One thought is to rename fh_is_managed to something like detached_data or data_detached since a fh is only opened when the data is detached from the header. Just a nit.

Can you add some tests for this? You could probably update the existing tests to verify they're properly closing or not closing the fh.

@jackriccomini
Copy link
Author

Fair point about the variable name. Whilst making that change, I realised introducing a new variable is unneccesary and I could simplify by checking data_filename is not None instead.

I have amended my commit to include that change and a unit test

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.

read_data(_, file) closes file prematurely
2 participants