Skip to content

Commit 2690525

Browse files
committed
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.
1 parent 5b991ae commit 2690525

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

py/objarray.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,18 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value
136136
if (value == MP_OBJ_NULL) {
137137
// delete item
138138
// TODO implement
139+
// TODO: confirmed that both bytearray and array.array support
140+
// slice deletion
139141
return MP_OBJ_NOT_SUPPORTED;
140142
} else {
141143
mp_obj_array_t *o = self_in;
142144
if (MP_OBJ_IS_TYPE(index_in, &mp_type_slice)) {
145+
if (value != MP_OBJ_SENTINEL) {
146+
// Only getting a slice is suported so far, not assignment
147+
// TODO: confirmed that both bytearray and array.array support
148+
// slice assignment (incl. of different size)
149+
return MP_OBJ_NOT_SUPPORTED;
150+
}
143151
machine_uint_t start, stop;
144152
if (!m_seq_get_fast_slice_indexes(o->len, index_in, &start, &stop)) {
145153
assert(0);

0 commit comments

Comments
 (0)