-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG,DEP: Fix writeable flag setting for arrays without base #13463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I may add a fix for Mattis PR here probably (with a test), but if someone reviews it before that, will just open a new PR afterwards. |
1, &zero, NULL, &zero, flags, NULL); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a comment what is the purpose of this function, it is a bit obscure at first glance.
"which do not own their data.") < 0) { | ||
return NULL; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new deprecation should appear in the release notes
aa88116
to
bba44ee
Compare
Add some docs and release notes (only changes). |
doc/release/1.17.0-notes.rst
Outdated
-------------------------------------- | ||
When an array is created from the C-API to wrap already existing data and | ||
the array does not own its data (frees it after destruction) it will not be | ||
possible to switch its writeable flag to ``True`` in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe clearer to state the reason:
"When an array is created from the C-API to wrap a pointer to data, the only indication we have of the read-write nature of the data is the writeable
flag set during creation. It is dangerous to force the flag to writeable
. In the future it will not be possible to switch the writeable flag to True
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that is better, added a "from python" at the end.
This also deprecates setting a non-writeable array to writeable if that array does not own its data (and has no base object to check if the memory may be writeable). (Deprecation on Python side only) Closes numpygh-481
Thanks @seberg, this also closes the second-oldest open issue! |
This also deprecates setting a non-writeable array to writeable if
that array does not own its data (and has no base object to check if
the memory may be writeable). (Deprecation on Python side only)
Closes gh-481
Well, this was probably a waste of time, thought it would be quicker, but should be reasonable in any case...