Ensure returned numpy arrays are not writeable#164
Merged
AlexanderWells-diamond merged 1 commit intomasterfrom Jul 12, 2024
Merged
Ensure returned numpy arrays are not writeable#164AlexanderWells-diamond merged 1 commit intomasterfrom
AlexanderWells-diamond merged 1 commit intomasterfrom
Conversation
0ddbfe8 to
8e555c2
Compare
Unit Test Results 6 files ±0 6 suites ±0 4m 58s ⏱️ -1s For more details on these errors, see this check. Results for commit 8c4b516. ± Comparison against base commit d38df9b. ♻️ This comment has been updated with latest results. |
Araneidae
reviewed
Jul 12, 2024
Araneidae
approved these changes
Jul 12, 2024
Collaborator
Araneidae
left a comment
There was a problem hiding this comment.
This is technically a breaking change, but not I think worth a major version bump. It would be nice to check if this does break any naughty code ... topup seems a good candidate to check!
8e555c2 to
8c4b516
Compare
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.
As we return a reference to the numpy array, rather than a copy, we want to ensure that the value is not modified under our noses.
Now when you try and modify a returned array there will be a ValueError raised.
See documentation here:
https://numpy.org/doc/stable/reference/generated/numpy.ndarray.flags.html