-
-
Notifications
You must be signed in to change notification settings - Fork 11k
segfault in _IsWriteable when data is not owned #481
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
Labels
Comments
Merged
Still broken, FWIW. |
It seems there are many places that Is it worth considering always checking for |
seberg
added a commit
to seberg/numpy
that referenced
this issue
May 16, 2019
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
charris
pushed a commit
to charris/numpy
that referenced
this issue
May 24, 2019
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following, albeit slightly contrived, example causes a segfault in _IsWriteable.
foo.pyx:
test.py:
python test.py
-> segmentation faultHere's _IsWriteable (with unnecessary bits removed).
a.setflags(write=True) works because
ap == a
base == NULL
and we hit the first condition (base is NULL or we own the data)
b.setflags(write=True) doesn't work because
ap == b
base == a
b.flags['OWNDATA'] == False
so we go into the loop:
base doesn't own the data either, so we try and find the base of a, which is NULL, and PyArray_Check(NULL) is a segfault.
I think the fix is
But I'm not sure which of returning True or False is correct.
The text was updated successfully, but these errors were encountered: