-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Fix indexing boolean ranges with empty ranges #40764
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
Merged
Conversation
This file contains hidden or 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
Member
Author
|
bump |
Member
|
@mbauman Any thoughts here? If you generally think this is ok, we can get it rebased and merged. |
Member
|
I believe this is good to merge. |
Member
|
@ViralBShah @mbauman CI is green, but it's not clear whether or not this PR has had an approving review. |
N5N3
reviewed
Sep 13, 2022
vtjnash
reviewed
Jul 6, 2023
Reviewing the work here, it seems undesirable to me now to actually to
make the majority of this change. We already define too much of what the
value of start should be, and trying to assume that one(T):zero(T) is in
range for T<:Integer is not necessarily ideal either.
This keeps some minor semi-related changes though:
- ensured this only happens when first(r)+first(s)*st == typemax
- if the range is supposed to be empty, then use a step of eps=1 (as
steprange_last_empty will do later), to reduce the size of the set of
values that overflow and become !isempty or error to 1 value instead of
step values
- Handle a convoluted case of StepRangeLen{Bool} indexing into a Vector
returning the element from the wrong end
```
julia> (typemin(Int)+1:100:zero(Int))[1:0] |> length
184467440737095516 # old
0 # new
```
0e51e09 to
98ec3cc
Compare
Member
|
@nanosoldier |
Collaborator
|
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. |
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.
Fixes #40760
Now