-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Python] BUG: Empty slicing an array backwards beyond the start should be empty #40642
Comments
Thanks for the catch! Yet another annoying corner case .. I was wondering if there isn't some existing functionality to "normalize" slice objects, and https://stackoverflow.com/questions/6246084/sanitize-python-slice pointed to https://docs.python.org/3/reference/datamodel.html#slice.indices We could test if that helps for us. Although for the case above it still gives negative start/stop values .. :
|
(and so this case actually worked before, so going to mark as critical for 16.0) |
Using |
I am moving this to 17.0.0. Let me know if this is required for the 16.0.0 release. |
Moved this back to 16.0, because it is a regression that we caused ourselves that for now only lives on main, so we can prevent this gets released. Will look into updating/merging the PR. |
…is now empty (#40682) ### What changes are included in this PR? `_normalize_slice` now relies on `slice.indices` (https://docs.python.org/3/reference/datamodel.html#slice.indices). ### Are these changes tested? Yes. ### Are there any user-facing changes? Fixing wrong data returned in an edge case. * GitHub Issue: #40642 * GitHub Issue: #38768 Lead-authored-by: LucasG0 <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
Resolved by #40682 |
@raulcd not fully familiar with the cherry-picking script, but the PR was pointing to an older already closed issues, and I only renamed it to point to this issue after merging with the merge script. Just mentioning in case that might affect it getting picked up by the backporting. |
…is now empty (#40682) ### What changes are included in this PR? `_normalize_slice` now relies on `slice.indices` (https://docs.python.org/3/reference/datamodel.html#slice.indices). ### Are these changes tested? Yes. ### Are there any user-facing changes? Fixing wrong data returned in an edge case. * GitHub Issue: #40642 * GitHub Issue: #38768 Lead-authored-by: LucasG0 <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
@jorisvandenbossche this has been cherry-picked to the 16.0.0 maintenance branch. The cherry-pick script picked it up without further action on my side. |
…start is now empty (apache#40682) ### What changes are included in this PR? `_normalize_slice` now relies on `slice.indices` (https://docs.python.org/3/reference/datamodel.html#slice.indices). ### Are these changes tested? Yes. ### Are there any user-facing changes? Fixing wrong data returned in an edge case. * GitHub Issue: apache#40642 * GitHub Issue: apache#38768 Lead-authored-by: LucasG0 <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
…start is now empty (apache#40682) ### What changes are included in this PR? `_normalize_slice` now relies on `slice.indices` (https://docs.python.org/3/reference/datamodel.html#slice.indices). ### Are these changes tested? Yes. ### Are there any user-facing changes? Fixing wrong data returned in an edge case. * GitHub Issue: apache#40642 * GitHub Issue: apache#38768 Lead-authored-by: LucasG0 <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
…start is now empty (apache#40682) ### What changes are included in this PR? `_normalize_slice` now relies on `slice.indices` (https://docs.python.org/3/reference/datamodel.html#slice.indices). ### Are these changes tested? Yes. ### Are there any user-facing changes? Fixing wrong data returned in an edge case. * GitHub Issue: apache#40642 * GitHub Issue: apache#38768 Lead-authored-by: LucasG0 <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
…start is now empty (apache#40682) ### What changes are included in this PR? `_normalize_slice` now relies on `slice.indices` (https://docs.python.org/3/reference/datamodel.html#slice.indices). ### Are these changes tested? Yes. ### Are there any user-facing changes? Fixing wrong data returned in an edge case. * GitHub Issue: apache#40642 * GitHub Issue: apache#38768 Lead-authored-by: LucasG0 <[email protected]> Co-authored-by: Joris Van den Bossche <[email protected]> Signed-off-by: Joris Van den Bossche <[email protected]>
Describe the bug, including details regarding any error messages, version, and platform.
I think post #39240, slicing with an empty slice under the same conditions returns the first element when the result should be empty
cc @LucasG0 @jorisvandenbossche
Component(s)
Python
The text was updated successfully, but these errors were encountered: