Skip to content

Conversation

@jackriccomini
Copy link
Contributor

@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
Contributor 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

@addisonElliott addisonElliott merged commit e31ba48 into mhe:master Jan 23, 2025
4 checks passed
@addisonElliott
Copy link
Collaborator

Thanks for the PR and sorry for the delay. I'll deploy a new version shortly.

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