-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: test, fix problems from PR #9639 #10160
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 know this is probably going to be disappointing, but IMO changing C code right before a release is playing with fire. Everyone wants their PRs merged (including me!), but sometimes you don't make it on time. |
In any case this could be merged to master |
Definitely agree that it should be merged to master ASAP. |
Yeah, these are the two bugfixes we need, so looks good. But one other thing I am concerned about: Didn't you need to sprinkle use of |
@ahaldane You can see all of the PRs with https://github.com/numpy/numpy/pulls?q=is%3Apr+author%3Amattip+is%3Aclosed It should be really easy to revert all of them on the 1.14 branch once it's created. |
We also need to revert #10022 on the 1.14 branch though. |
@xoviat wait I am confused. I thought your goal with this PR was not to revert any of the merged PRs, even on 1.14. I thought the idea was we would merge this PR to fix the bugs in |
I think that's @mattip's goal. My view on this is that either we need to:
|
Py_DECREF(fa->base); | ||
if (fa->base) { | ||
Py_DECREF(fa->base); | ||
} |
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.
This can be Py_XDECREF
.
Otherwise the code and test in this PR look good to me, lets just let it sit a little before merging. |
@ahaldane #9639 does not break C code, in the worst case a warning is only emitted if during We were very careful to make an exception for nditer in #9639, and not to force anyone to do anything at this stage. That was the purpose of #9998. The code you see in |
Since it is more than likely #9998 will not make the 1.14 cut, I tried to document the situation |
Let's just hold off branching for a few days then and then we can put this in. |
@mattip, OK I see better what is going on, and that the I'm going to look over this one more time and merge in a little while. |
All right, let's do this. Thanks for explaining @mattip. |
PR #9639 was merged, but later we uncovered some problems with it in working on PR #9998.
@ahaldane uncovered a bug where the NPY_WRITEBACKIFCOPY flag was not zeroed out in creating a ndarray from existing data.
Additionally, I realized that between the call to
PyArray_ResolveWritebackIfCopy
andarray_dealloc
, the ndarray is still, in some sense, alive, and so care must be taken to leave it in a coherent state after the call toPyArray_ResolveWritebackIfCopy
.This pull request tests and fixes both the problems above, where
arr_wb.flags.writebackifcopy == True
andarr_wb.base
isarr
:arr_wb[:]
assignment, which internally creates a view toarr_wb
, does not create the view with writeback semantics (error in zeroing out the view's flag)PyArray_WritebackIfCopy(arr_wb)
, the data pointer ofarr_wb
is still valid, but that the connection betweenarr_wb
andarr
has been severed,arr_wb.base
is no longerarr