Skip to content

[Python] Weird exception when slicing an array with non-trivial step #46606

Closed
@pitrou

Description

@pitrou

Describe the bug, including details regarding any error messages, version, and platform.

I don't know if we can easily support this, but it should at least fail with a more readable error:

>>> a = pa.array([1.2, 3.5, None])
>>> a
<pyarrow.lib.DoubleArray object at 0x7d05b7f25900>
[
  1.2,
  3.5,
  null
]
>>> a[::-1]
Traceback (most recent call last):
  Cell In[4], line 1
    a[::-1]
  File pyarrow/array.pxi:1523 in pyarrow.lib.Array.__getitem__
  File pyarrow/array.pxi:587 in pyarrow.lib._normalize_slice
AttributeError: 'NoneType' object has no attribute 'arange'

Component(s)

Python

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions