You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Alessandro Molina (Jira)" <ji...@apache.org> on 2021/05/27 14:15:00 UTC
[jira] [Created] (ARROW-12893) [Python] Slicing array can lead to
negative length
Alessandro Molina created ARROW-12893:
-----------------------------------------
Summary: [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
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)