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
BUG: Ignore fewer errors during array-coercion #17817
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seberg
force-pushed
the
test-bad-array-like
branch
2 times, most recently
from
November 21, 2020 17:21
d3bea0e
to
3067ada
Compare
This changes it so that we only ignore attribute errors on looking up `__array__` and propagate errors when checking for sequences `len(obj)` if those errors are either RecursionError or MemoryError (we consider them unrecoverable). Also adds test for bad recursive array-like with sequence as reported in numpygh-17785. The test might be flaky/more complicated in which case it should probably just be deleted.
seberg
force-pushed
the
test-bad-array-like
branch
from
November 24, 2020 21:03
3067ada
to
b17dd63
Compare
mattip
approved these changes
Dec 16, 2020
LGTM. Can we put this in soon, it is holding gh-17786 back. |
I think this closes gh-17785 |
@mattip it seems to close it in most cases, but I tried incorporating it in CI here and there were always some ways it still came back to bite. Although, maybe on master it at least crashes only with a fatal python error and not with a stack overflow (I don't remember). |
Thanks @seberg |
charris
added
component: numpy._core
and removed
09 - Backport-Candidate
PRs tagged should be backported
labels
Dec 18, 2020
seberg
added a commit
to seberg/numpy
that referenced
this pull request
Jan 20, 2021
Closes (the later point) in numpygh-17965 and reverts parts of numpygh-17817. Shapely did rely on being able to raise a NotImplementedError which then got ignored in the attribute lookup. Arguably, this should probably just raise an AttributeError to achieve that behaviour, but it means we can't just rip the band-aid off here. Since 1.20 is practically released, just reverting most of the change (leaving only recursion and memory error which are both arguably pretty fatal). Ignoring most errors should be deprecated (and I am happy to do so), but it is not important enough for 1.20 or very important in itself. Closes numpygh-17965
charris
pushed a commit
to charris/numpy
that referenced
this pull request
Jan 21, 2021
Closes (the later point) in numpygh-17965 and reverts parts of numpygh-17817. Shapely did rely on being able to raise a NotImplementedError which then got ignored in the attribute lookup. Arguably, this should probably just raise an AttributeError to achieve that behaviour, but it means we can't just rip the band-aid off here. Since 1.20 is practically released, just reverting most of the change (leaving only recursion and memory error which are both arguably pretty fatal). Ignoring most errors should be deprecated (and I am happy to do so), but it is not important enough for 1.20 or very important in itself. Closes numpygh-17965
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes it so that we only ignore attribute errors on
looking up
__array__
and propagate errors when checkingfor sequences
len(obj)
if those errors are eitherRecursionError or MemoryError (we consider them unrecoverable).
Also adds test for bad recursive array-like with sequence
as reported in gh-17785. The test might be flaky/more complicated
in which case it should probably just be deleted.
OK, one more attempt with raising more erros... First attempt with checking for
RecursionError
in the test, but lets see...