Skip to content

[Python] Negative out of range slices yield invalid arrays #28510

@asfimport

Description

@asfimport

Tested on pyarrow 2.0 and pyarrow 4.0 wheels.  The errors are slightly different between the 2.0.  Below is a script from 4.0

 

This is taken from the result of test_slice_array

 
>>> import pyarrow as pa
>>> pa.array(range(0,10))
<pyarrow.lib.Int64Array object at 0x7f59b8bdab20>
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9
]
>>> a=pa.array(range(0,10))
>>> a[-9:-20]
<pyarrow.lib.Int64Array object at 0x7f59b8bdaa00>
[]
>>> len(a[-9:-20])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: <built-in function len> returned NULL without setting an error

Reporter: Micah Kornfield / @emkornfield
Assignee: Joris Van den Bossche / @jorisvandenbossche

Related issues:

PRs and other links:

Note: This issue was originally created as ARROW-12769. Please see the migration documentation for further details.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions