Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BUG: Remove the broken clip wrapper #14145

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

Merged
merged 1 commit into from
Jul 30, 2019
Merged

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Jul 28, 2019

ndarray.clip is already just a wrapper for the ufunc, so there is no need to do type-specific wrapping here any more

Fixes #14140

Backportable via the web UI

ndarray.clip is already just a wrapper for the ufunc, so there is no need to do type-specific wrapping here any more

Fixes numpygh-14140
@seberg
Copy link
Member

seberg commented Jul 30, 2019

Thanks Eric. Looks good to me. Annoying, but not much to be done, one of the things that happens when moving things to be ufuncs (arguable, the old clip was the issue here).

EDIT: to be clear for the future, the only issue the out argument. clip previously seemingly ignored it on the out array. But if this is wrapped, the masked array is converted to a normal array removing the mask information. With the wrapper the first result should have nothing masked. The wrapper could likely be fixed, but it is not necessary here.

@seberg seberg merged commit f12c632 into numpy:master Jul 30, 2019
@eric-wieser
Copy link
Member Author

I think you're right, something is fishy with the wrapper. It's probably worth seeing if there are similar problems with the out arguments to other wrappers.

@seberg
Copy link
Member

seberg commented Jul 31, 2019

Hmm, wasn't really planning into looking into it, but I guess just because I dislike masked arrays :(. I think the mask should be copied before the operation. But to be honest, things might be tricky, such as needing to handle out=self specifically or so.

@eric-wieser
Copy link
Member Author

I might get around to taking a look

@charris charris added component: numpy.ma masked arrays and removed 09 - Backport-Candidate PRs tagged should be backported component: numpy.ufunc labels Aug 4, 2019
@charris charris removed this from the 1.17.1 release milestone Aug 4, 2019
@eric-wieser eric-wieser deleted the fix-14140 branch September 14, 2019 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistency of np.clip with MaskedArray when using output argument
3 participants