Skip to content

Close file pointer in finally clause - #125

Merged
CPBridge merged 1 commit into
ImagingDataCommons:masterfrom
erikogabrielsson:bugfix/close-fp
Jul 28, 2026
Merged

Close file pointer in finally clause#125
CPBridge merged 1 commit into
ImagingDataCommons:masterfrom
erikogabrielsson:bugfix/close-fp

Conversation

@erikogabrielsson

Copy link
Copy Markdown
Contributor

Exceptions in DICOMfileClient retrieve_instance_rendered(), iter_instance_frames(), retrieve_instance_frames(), andretrieve_instance_frames_rendered() or if caller abandons iteration early on iter_instance_frames() leaves the image_file_pointer open. Change so that it is always closed in a finally block.

@sonarqubecloud

Copy link
Copy Markdown

@pieper pieper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds like a good fix. Can you look at the automated suggestions?

@erikogabrielsson

Copy link
Copy Markdown
Contributor Author

@pieper: Do you mean the suggestions from sonarqubecloud? They do not look to be related to the bug fix.

@pieper

pieper commented Jul 12, 2026

Copy link
Copy Markdown
Member

Okay, if the issues are unrelated then you don't need to resolve them.

I haven't worked on this code for a while so I'm hesitant to make changes. Is there anyone else who uses this package actively who would like to review?

@CPBridge

Copy link
Copy Markdown
Collaborator

@pieper I will take a look in the next couple of days

@CPBridge CPBridge left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @erikogabrielsson !

@CPBridge

Copy link
Copy Markdown
Collaborator

I'm going to go ahead, merge this, and put out a patch release (0.61.1)

@CPBridge

Copy link
Copy Markdown
Collaborator

@pieper note that the automated suggestions are nothing to do with the changes introduced in this PR so it doesn't make sense to fix them here, in my opinion. I created #126 to address them

@CPBridge
CPBridge merged commit 46e38d3 into ImagingDataCommons:master Jul 28, 2026
7 checks passed
CPBridge added a commit that referenced this pull request Jul 28, 2026
…stions

Fix sonar cloud suggestions from PR #125
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.

3 participants