Skip to content

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

Merged

Conversation

mhvk
Copy link
Contributor

@mhvk mhvk commented Dec 20, 2017

This helps avoid unnecessary cleanup.

@@ -4952,6 +4947,7 @@ ufunc_at(PyUFuncObject *ufunc, PyObject *args)
return override;
}

NPY_BEGIN_THREADS_DEF;
Copy link
Member

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...)

Copy link
Contributor Author

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).

@mhvk mhvk force-pushed the array-ufunc-remove-some-unnecessary-work branch from f945bca to ba33770 Compare December 20, 2017 21:16
@eric-wieser
Copy link
Member

Doesn't look like you pushed the fix

@mhvk mhvk force-pushed the array-ufunc-remove-some-unnecessary-work branch from ba33770 to 7ebb000 Compare December 21, 2017 13:55
@mhvk
Copy link
Contributor Author

mhvk commented Dec 21, 2017

Indeed, silly of me. Now done.

for (i = 0; i < ufunc->nargs; i++) {
PyArray_DiscardWritebackIfCopy(mps[i]);
Py_XDECREF(mps[i]);
}
Copy link
Member

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...

Copy link
Contributor Author

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.

@eric-wieser eric-wieser merged commit 10f00f6 into numpy:master Dec 21, 2017
@eric-wieser
Copy link
Member

Thanks!

@mhvk mhvk deleted the array-ufunc-remove-some-unnecessary-work branch December 21, 2017 20:58
@charris charris changed the title MAINT: Check for __array_ufunc__ before doing anything else. MAINT: Check for __array_ufunc__ before doing anything else. Jun 16, 2018
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.

2 participants