Skip to content

MAINT/DEP: properly implement ndarray.__pos__ - #11450

Merged
mhvk merged 3 commits into
numpy:masterfrom
mhvk:ndarray-implement-pos
Jul 26, 2018
Merged

mhvk merged 3 commits into
numpy:masterfrom
mhvk:ndarray-implement-pos

Conversation

@mhvk

@mhvk mhvk commented Jun 29, 2018

Copy link
Copy Markdown
Contributor

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.

Comment thread numpy/core/src/multiarray/number.c Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Contributor Author

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)

@mattip

mattip commented Jun 29, 2018

Copy link
Copy Markdown
Member

Why was this different, historically, than array_negative or array_absolute? It seems strange to special case only array_positive

@mhvk
mhvk force-pushed the ndarray-implement-pos branch 2 times, most recently from 325e0b6 to 31ac6cd Compare June 29, 2018 14:05
@mhvk

mhvk commented Jun 29, 2018

Copy link
Copy Markdown
Contributor Author

@mattip - I'm guessing it was just a short-cut. Certainly, np.positive didn't exist until recently.

Comment thread numpy/core/src/private/ufunc_override.c Outdated

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

edit: nevermind

@eric-wieser

Copy link
Copy Markdown
Member

Commit tag should definitely contain DEP, since this has a deprecation

@eric-wieser eric-wieser changed the title MAINT: properly implement ndarray.__pos__ MAINT/DEP: properly implement ndarray.__pos__ Jun 30, 2018
@mhvk
mhvk force-pushed the ndarray-implement-pos branch from b770252 to f13ab50 Compare June 30, 2018 22:10
@mhvk

mhvk commented Jun 30, 2018

Copy link
Copy Markdown
Contributor Author

OK, I changed the commit message to include "DEP".

Comment thread numpy/core/src/multiarray/number.c Outdated

@eric-wieser eric-wieser Jun 30, 2018 •

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor Author

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

@eric-wieser eric-wieser left a comment

Copy link
Copy Markdown
Member

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

@mhvk
mhvk force-pushed the ndarray-implement-pos branch from f13ab50 to ac1e129 Compare July 1, 2018 14:03
@mhvk

mhvk commented Jul 2, 2018

Copy link
Copy Markdown
Contributor Author

@eric-wieser - I addressed your comment. OK to merge?

@mattip

mattip commented Jul 26, 2018

Copy link
Copy Markdown
Member

@eric-wieser could you comment on the changes you requested?

@mhvk it seems a rebase is needed

mhvk added 3 commits July 26, 2018 09:54
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.
@mhvk
mhvk force-pushed the ndarray-implement-pos branch from ac1e129 to 3207785 Compare July 26, 2018 14:04
@mhvk

mhvk commented Jul 26, 2018

Copy link
Copy Markdown
Contributor Author

@mattip - thanks for noticing... now rebased and approved, so can go in if tests pass.

@mhvk
mhvk merged commit ff8197b into numpy:master Jul 26, 2018
@mhvk
mhvk deleted the ndarray-implement-pos branch July 26, 2018 15:08
@charris charris changed the title MAINT/DEP: properly implement ndarray.__pos__ MAINT/DEP: properly implement ndarray.__pos__ Nov 10, 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.

ENH: call np.positive in ndarray.__pos__, and issue a deprecation warning when it falls

3 participants