Skip to content
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

DEP: Deprecate error clearing for special method in array-coercion #19001

Merged
merged 4 commits into from May 19, 2021

Conversation

seberg
Copy link
Member

@seberg seberg commented May 13, 2021

When looking up __array__ and __array_interface__, previously
most errors were ignored (during the attribute lookup for array).

This deprecates this, in the future only AttributeError (which is
ignored in LookupSpecial itself) will be ignored.

Closes gh-18723


Closes gh-18199 I feel like there is probably at least one more issue open, but didn't find it.

@seberg seberg force-pushed the deprecate-error-ignoring-array-creation branch 2 times, most recently from 4313e08 to 7cfac52 Compare May 13, 2021 17:15
When looking up `__array__` and `__array_interface__`, previously
most errors were ignored (during the attribute lookup for __array__).

This deprecates this, in the future only AttributeError (which is
ignored in `LookupSpecial` itself) will be ignored.

Closes numpygh-18723
@seberg seberg force-pushed the deprecate-error-ignoring-array-creation branch from 7cfac52 to e04c760 Compare May 14, 2021 22:48
attributes ``__array__`` or ``__array_interface__``, this error
was usually ignored.
A warning is now given when the error is anything but AttributeError.
To silence the warning, the type raising a warning has to be adapted
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
To silence the warning, the type raising a warning has to be adapted
To silence the warning, the type raising the exception has to be adapted

Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

Looks sensible, although it might be better to use the word "exception" rather than "error in a few places.

@charris charris added this to the 1.21.0 release milestone May 19, 2021
@seberg
Copy link
Member Author

seberg commented May 19, 2021

Well, that was confusing :). I changed the error message (error -> exception), so the warning filter was not set up correctly in the test and thus the strange failure.

Should probably just squash merge this...

@charris charris merged commit 290a034 into numpy:main May 19, 2021
@charris
Copy link
Member

charris commented May 19, 2021

Thanks Sebastian.

@radarhere
Copy link
Contributor

Thanks. Just out of interest, is there a standard numpy timeline on moving from deprecation to exception?

@seberg
Copy link
Member Author

seberg commented May 19, 2021

@radarhere typically 2 releases (EDIT: 2 releases means 1 year), although its not uncommen we forget, but after two releases we will definitely merge a PR unless there is some protest. If there are very good reasons, I guess we could speed things up after some discussion. (In this case, the only known issue was because shapely ran into this change, since shapely is fixed, I might consider it. But it should still have a good reason of why it helps.)

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.

np.array silently catching errors DEP: Deprecate error clearing in array-protocol attribute fetching
4 participants