Skip to content
Snippets Groups Projects
Commit 77f85db4 authored by Damien George's avatar Damien George
Browse files

py/objarray: Fix array slice assignment when array is reallocated.

Addresses issue #1898.
parent 06b39848
No related branches found
No related tags found
No related merge requests found
......@@ -439,6 +439,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
// TODO: alloc policy; at the moment we go conservative
o->items = m_renew(byte, o->items, (o->len + o->free) * item_sz, (o->len + len_adj) * item_sz);
o->free = 0;
dest_items = o->items;
}
mp_seq_replace_slice_grow_inplace(dest_items, o->len,
slice.start, slice.stop, src_items, src_len, len_adj, item_sz);
......
......@@ -47,6 +47,9 @@ b = bytearray(2)
b[2:] = bytearray(10)
print(b)
b = bytearray(10)
b[:-1] = bytearray(500)
print(len(b), b[0], b[-1])
# Assignment of bytes to array slice
b = bytearray(2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment