Use built in method numpy.set_printoptions in addObject/addChild methods to enable numpy 2 #518
Merged
hugtalbot merged 4 commits intosofa-framework:masterfrom Jul 16, 2025
Conversation
…egacy repr for numpy objects. This is ocmpatible with numpy 1
hugtalbot
approved these changes
Jul 15, 2025
Contributor
hugtalbot
left a comment
There was a problem hiding this comment.
Even if some refactoring could have been done (use a function to avoid repeated code snippets), it would require multiple load of numpy which I doubt we also desire
fredroy
reviewed
Jul 16, 2025
fredroy
reviewed
Jul 16, 2025
Co-authored-by: Frederick Roy <fredroy@users.noreply.github.com>
hugtalbot
added a commit
that referenced
this pull request
Jul 16, 2025
…ods to enable numpy 2 (#518) * Use set_printoptions(legacy=True) in node binfing to force usage of legacy repr for numpy objects. This is ocmpatible with numpy 1 * Patch addChild * Add RAII mechanism to make sure numpy is put back its initial state * Add [[maybe_unused]] Co-authored-by: Frederick Roy <fredroy@users.noreply.github.com> --------- Co-authored-by: Hugo <hugo.talbot@sofa-framework.org> Co-authored-by: Frederick Roy <fredroy@users.noreply.github.com>
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.
Use set_printoptions(legacy=True) in node binding to force usage of legacy repr for numpy objects. This is compatible with numpy 1
This still uses string representation of all arguments when calling addObject or addChild, which reduces the possibles bugs.