[ 
https://issues.apache.org/jira/browse/ARROW-12893?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alessandro Molina resolved ARROW-12893.
---------------------------------------
    Resolution: Fixed

> [Python] Slicing array can lead to negative length
> --------------------------------------------------
>
>                 Key: ARROW-12893
>                 URL: https://issues.apache.org/jira/browse/ARROW-12893
>             Project: Apache Arrow
>          Issue Type: Bug
>            Reporter: Alessandro Molina
>            Assignee: Alessandro Molina
>            Priority: Major
>
> Slice an arrow array can lead to a negative length, when instead it should 
> never be smaller than 0.
> {code}
> arr = pa.array(range(10))
> assert len(arr[-9:-20]) == 0
> {code}
> {{Array.length()}} returns {{-1}} which makes the previous snippet crash as 
> Python never accepts length < 0
> In particular if you have Python in debug mode it will explicitly fail the 
> related assertion
> {{Assertion failed: (len >= 0 || PyErr_Occurred()), function PyObject_Size, 
> file Objects/abstract.c, line 61}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to