-
-
Notifications
You must be signed in to change notification settings - Fork 11k
MAINT/DEP: properly implement ndarray.__pos__
#11450
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
Conversation
numpy/core/src/multiarray/number.c
Outdated
PyObject *mod; | ||
if (mod) { | ||
Py_DECREF(mod); | ||
} |
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 looks wrong. What is mod?
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, leftover from debugging!! (I had the problem that has_not_default...
doesn't work when an error is set)
Why was this different, historically, than |
325e0b6
to
31ac6cd
Compare
@mattip - I'm guessing it was just a short-cut. Certainly, |
@@ -61,7 +61,7 @@ get_non_default_array_ufunc(PyObject *obj) | |||
* Returns 1 if this is the case, 0 if not. | |||
*/ | |||
|
|||
static int | |||
NPY_NO_EXPORT int |
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.
nit: This doesn't belong in this PR
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.
edit: nevermind
Commit tag should definitely contain |
b770252
to
f13ab50
Compare
OK, I changed the commit message to include "DEP". |
numpy/core/src/multiarray/number.c
Outdated
} | ||
/* 2018-06-28, 1.16.0 */ | ||
if (DEPRECATE("Applying '+' to a non-numerical array is " | ||
"ambigous. Returning a copy, but in the future " |
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.
Typo: ambiguous
.
Is this even true? It's just ill-defined (no possible meanings), not ambiguous (>1 possible meanings).
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.
OK, replaced with "ill-defined".
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.
Just drawing attention to my comment above
f13ab50
to
ac1e129
Compare
@eric-wieser - I addressed your comment. OK to merge? |
@eric-wieser could you comment on the changes you requested? @mhvk it seems a rebase is needed |
Rather than rely on +array doing that for it.
For regular arrays, we now give a deprecation warning if np.positive cannot handle it; for ndarray subclasses that override __array_ufunc__, we pass on the type error.
ac1e129
to
3207785
Compare
@mattip - thanks for noticing... now rebased and approved, so can go in if tests pass. |
ndarray.__pos__
fixed #9081
For regular arrays, we now give a deprecation warning if np.positive cannot handle it; for ndarray subclasses that override array_ufunc, we pass on the type error.