Skip to content

Accessing an element in a ulab array with a float causes a hard fault #3594

@kevinjwalters

Description

@kevinjwalters

On a CLUE using 6.0.0-rc.0, haven't tried other versions:

Adafruit CircuitPython 6.0.0-rc.0 on 2020-10-20; Adafruit CLUE nRF52840 Express with nRF52840
>>>
>>>
>>> import ulab
>>> import array
>>> li = [1.0] * 10
>>> ar = array.array('f', li)
>>> ular = ulab.ones(10)
>>>
>>> li[0.0]  # good
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list indices must be integers, not float
>>> ar[0.0]  # good
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: array indices must be integers, not float
>>> ular[0.0]

USB serial disconnected, firing up a new terminal quickly shows:

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
                                 Press any key to enter the REPL. Use CTRL-D to reload.

Maybe this issue will end up with a fix via https://github.com/v923z/micropython-ulab

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions