← index #6523PR #7724
Related · high · value 0.318
QUERY · ISSUE

Taking slice of memoryview in Viper function crashes PyBoard

openby twisteroidambassadoropened 2020-10-07updated 2025-07-02
bugpy-core

On a PyBoard v1.1 with firmware 1.13, put the following code into a file:

import micropython


@micropython.viper
def take_memoryview_slice():
    ba = bytearray(10)
    mv = memoryview(ba)
    slice = mv[0:1]

Running take_memoryview_slice() resets the PyBoard.

CANDIDATE · PULL REQUEST

speed_python.rst: Slicing a memoryview causes allocation.

closedby peterhinchopened 2021-08-27updated 2021-08-30
docs

Clarify the reason why slicing a memoryview can't be done in an ISR.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied