Skip to content
Snippets Groups Projects
Commit 26905259 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

objarray: Slice subscription operation: properly test for op subtype.

Also, checked that both bytearray and array.array actually support generic
(a-la list) slice assignment and deletion. Added TODOs.
parent 5b991ae2
Branches
No related tags found
No related merge requests found
...@@ -136,10 +136,18 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value ...@@ -136,10 +136,18 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
if (value == MP_OBJ_NULL) { if (value == MP_OBJ_NULL) {
// delete item // delete item
// TODO implement // TODO implement
// TODO: confirmed that both bytearray and array.array support
// slice deletion
return MP_OBJ_NOT_SUPPORTED; return MP_OBJ_NOT_SUPPORTED;
} else { } else {
mp_obj_array_t *o = self_in; mp_obj_array_t *o = self_in;
if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) { if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) {
if (value != MP_OBJ_SENTINEL) {
// Only getting a slice is suported so far, not assignment
// TODO: confirmed that both bytearray and array.array support
// slice assignment (incl. of different size)
return MP_OBJ_NOT_SUPPORTED;
}
machine_uint_t start, stop; machine_uint_t start, stop;
if (!m_seq_get_fast_slice_indexes(o->len, index_in, &start, &stop)) { if (!m_seq_get_fast_slice_indexes(o->len, index_in, &start, &stop)) {
assert(0); assert(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment