Fix undocumented reopen behavior in Python#4106
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4106 +/- ##
==========================================
+ Coverage 65.90% 65.93% +0.03%
==========================================
Files 158 158
Lines 21000 21002 +2
Branches 1239 1237 -2
==========================================
+ Hits 13839 13848 +9
+ Misses 6748 6741 -7
Partials 413 413
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
The Python `SOMAObject.reopen` method is documented as creating a new `SOMAObject` with the requested mode and timestamp from an existing `SOMAObject`. The existing behavior closed and reopened the original `SOMAObject` in its original mode in order to write metadata to the object before reopening. This change instead throws an error if the original object has un-written metadata instructing the user to call close first. The existing object is not modified. This change allows the removal of all C++ reopen code. Simply calling ``open`` from the Python layer is a simplier and less error prone option.
bkmartinjr
reviewed
Jun 9, 2025
bkmartinjr
approved these changes
Jun 9, 2025
Member
bkmartinjr
left a comment
There was a problem hiding this comment.
one very minor comment - otherwise LGTM. Approving, but suggest addressing the nit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue and/or context:
Towards SOMA-168
Changes:
The Python
SOMAObject.reopenmethod is documented as creating a newSOMAObjectwith the requested mode and timestamp from an existingSOMAObject. The existing behavior was to close and reopen the originalSOMAObjectin its original mode in order to write metadata to the object before reopening, and would then create and return a newSOMAObjectwith the requested mode and timestamp.This breaking change will close the internal handle, open a new internal handle in the requested mode and timestamp, and return the original (i.e.
self) from the method in the requested mode and timestamp.