DEP: Drop deprecated boolean indexing behavior and update to new. - #8312
Conversation
|
Copied from post from @seberg. OK, this seems to do the trick: |
c13e8a4 to
1265f86
Compare
There was a problem hiding this comment.
Sure, the automated test, could probably be fixed, but we could even think about just removing this part since the other tests are more comprehensive nowadays.
There was a problem hiding this comment.
I had a glance at the code, I think I can probably fix it with two small modifications.
There was a problem hiding this comment.
I thought about removing it, not least because it is complicated.
There was a problem hiding this comment.
Good with me, it was very useful when there were not many tests, now its not awfully useful (hopefully). How about just removing this one case and maybe adding a comment that there is likely no point in supporting it indefinitely (could also move to its own file?). So that we can basically remove it whenever it should be too much trouble to tweak it?
Just am not sure if I like removing the test completely without a strong need. Who knows maybe it does test some things otherwise not tested, indexing is quite branched with many special cases.
There was a problem hiding this comment.
The whole test should probably be replaced with new tests for the new behaviour. Sounds like it tests old behaviour
There was a problem hiding this comment.
Just wondering if the tested behavior was no longer valid. I seems that now booleans and integers can be mixed.
1265f86 to
a92e6ed
Compare
|
OK, I've removed the failing tests. This should be ready to go unless more tests are desired. |
|
Should probably add tests for some of the wonkier behaviour like :/ I can try to write more some time. |
|
Obviously all of those examples don't make any real sense at all, but they are valid combinations of the nonsense boolean indexing rules. |
a92e6ed to
b005be2
Compare
|
OK, I added a |
There was a problem hiding this comment.
That test I guessed the result wrong... If its a True, its like a dimension of 1 and that means it can broadcast:
if ((indices[i].value == 0) && (mit->dimensions[mit->nd_fancy - 1] > 1)) {
should fix it. Wonky stuff mixing boolean arrays with other indexes....
There was a problem hiding this comment.
I guess the truth is, it is completely insane to do it anyway, but at least in my head there is a set of rules you can apply to get the result ;).
There was a problem hiding this comment.
Oh, I gave the wrong one, this is the one that fails:
a[True, [0, 1], True, True, [1], [[2]]]
Still need the fix?
There was a problem hiding this comment.
Yeah, I had pulled the PR to see the error message.
b005be2 to
2ac4537
Compare
|
OK, updated. |
|
LGTM. Its good to put this in early, who knows what problems might crop up. If you want I can try to write more tests some time, though could do that also after this is put in (could open an issue in that case I guess). Go ahead and put it in (or I can do it). |
|
Btw. thanks for taking care of all of this maintenance work! |
This affects mostly old boolean indexing behavior that was deprecated in NumPy 1.9. At the time the new behavior was causing errors in a number of downstream projects, hopefully that has been taken care of.
2ac4537 to
b80bcee
Compare
|
I've updated the release notes and will put this in. Thanks for the review. And of course more tests, and perhaps clarification in the release notes, are welcome ;) |
This affects mostly old boolean indexing behavior that was deprecated in NumPy 1.9. At the time the new behavior was causing errors in a number of downstream projects, hopefully that has been taken care of.