-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
MAINT: Check for __array_ufunc__
before doing anything else.
#10250
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
MAINT: Check for __array_ufunc__
before doing anything else.
#10250
Conversation
numpy/core/src/umath/ufunc_object.c
Outdated
@@ -4952,6 +4947,7 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args) | |||
return override; | |||
} | |||
|
|||
NPY_BEGIN_THREADS_DEF; |
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 is a definition, so has to be before any statements (yay, pre-C99...)
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.
Oops - now corrected. Possibly makes more sense if the real implementation is in a new function, but I'll leave that for another PR (I'm again looking at moving the implementation of ndarray ufunc to ndarray.__array_ufunc__
, or at least making the call there faster).
f945bca
to
ba33770
Compare
This helps avoid unnecessary cleanup.
Doesn't look like you pushed the fix |
ba33770
to
7ebb000
Compare
Indeed, silly of me. Now done. |
for (i = 0; i < ufunc->nargs; i++) { | ||
PyArray_DiscardWritebackIfCopy(mps[i]); | ||
Py_XDECREF(mps[i]); | ||
} |
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.
Wait, why was this even here? There's no way things can be non-null...
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.
That's right - that's what originally triggered me, and why I removed it. It was part of a much larger PR (#9639) and I think just an oversight.
Thanks! |
__array_ufunc__
before doing anything else.
This helps avoid unnecessary cleanup.