ENH: Allow where argument to override __array_ufunc__#23240
ENH: Allow where argument to override __array_ufunc__#23240seberg merged 1 commit intonumpy:mainfrom
where argument to override __array_ufunc__#23240Conversation
9b96e6d to
9dcb148
Compare
|
Does anyone know why the Travis CI build is failing? I've tried making sure my branch is ahead of numpy:main, but it still seems to be timing out. |
|
Not sure why I always think of things after sending in a review, but what is still needed is a changelog fragment. And relevant updates to the documentation (and an update/clarification of the NEP??). |
|
Agreed, a brief compat release note and modifying the NEP (I guess it is the main doc we have) would be good. Would also be nice to check up on what some I was briefly considering if we should refactor out the So I just agree with Marten, the code and test look nice and clean :). |
d43486a to
c45be60
Compare
90b0b5f to
983e2ae
Compare
mhvk
left a comment
There was a problem hiding this comment.
One nitpick and one suggestion, but really this looks great!
where argument to override __array_ufunc__where argument to override __array_ufunc__
93ea572 to
13f1e6e
Compare
2e6c5f6 to
ae00248
Compare
7f4915b to
5d9efe7
Compare
86efeb4 to
9f7472c
Compare
…o override `__array_ufunc__`.
9f7472c to
f3f108d
Compare
| #include "strfuncs.h" | ||
| #include "array_assign.h" | ||
| #include "npy_dlpack.h" | ||
| #include "multiarraymodule.h" |
There was a problem hiding this comment.
@seberg Is this the appropriate place to include this header?
|
Not relevant for this PR, but |
Oh sorry, in that case there was no reason to update it really... This path is not hot anyway (I suspect few users use No other suggestion beyond using interned strings. array-function passes |
|
@seberg, if we wanted to defer using |
|
@byrdie - indeed, which would be hard to do... Might need some opt-in signal or so. |
|
Yeah, I think that's probably out of scope for this PR, though I agree it would probably be better/faster if we did do that! |
|
@seberg, what can I do to get this merged? |
|
Considering that nobody voiced concerns, I think it is time to give this a shot. If anyone has concerns we could pull it out (at least easily before the next final release). Thanks @byrdie. |
Currently,
numpy.ndarray.__array_ufunc__does not allow thewhereargument to override the default behavior of the ufunc.This pull request allows this behavior by extending
PyUFunc_CheckOverrideto accept an additional argument that representswhere, and checks to see if it overrides__array_ufunc__.Closes Issue #23219