Skip to content

Ensure returned numpy arrays are not writeable - #164

Merged
AlexanderWells-diamond merged 1 commit into
masterfrom
make_returned_arrays_unwriteable
Jul 12, 2024
Merged

AlexanderWells-diamond merged 1 commit into
masterfrom
make_returned_arrays_unwriteable

Conversation

@AlexanderWells-diamond

Copy link
Copy Markdown
Collaborator

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

@github-actions

github-actions Bot commented Jul 11, 2024 •

Copy link
Copy Markdown

Unit Test Results

       6 files  ±0      6 suites  ±0   4m 58s ⏱️ -1s
   299 tests +1  282 ✔️ +1    16 💤 ±0  0 ❌ ±0  1 🔥 ±0 
1 196 runs  +4  968 ✔️ +4  224 💤 ±0  0 ❌ ±0  4 🔥 ±0 

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.

Comment thread softioc/device.py Outdated

@Araneidae Araneidae 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.

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!

@AlexanderWells-diamond
AlexanderWells-diamond force-pushed the make_returned_arrays_unwriteable branch from 8e555c2 to 8c4b516 Compare July 12, 2024 08:02
@AlexanderWells-diamond
AlexanderWells-diamond merged commit 8c4b516 into master Jul 12, 2024
@AlexanderWells-diamond
AlexanderWells-diamond deleted the make_returned_arrays_unwriteable branch January 7, 2026 09:25
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.

2 participants