diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-20 20:58:33 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-20 20:58:33 +0300 |
commit | 26905259d04ffa2ee9b1be2607bd680a40d8dfbe (patch) | |
tree | 4a48d118ceebf4aafd2444acb26ce38e916f403a /py | |
parent | 5b991ae2d3e2db32b3c77a9d140bb485a219e68d (diff) | |
download | micropython-26905259d04ffa2ee9b1be2607bd680a40d8dfbe.tar.gz micropython-26905259d04ffa2ee9b1be2607bd680a40d8dfbe.zip |
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.
Diffstat (limited to 'py')
-rw-r--r-- | py/objarray.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/py/objarray.c b/py/objarray.c index b7a84ba4cf..ce107ddf25 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -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) { // delete item // TODO implement + // TODO: confirmed that both bytearray and array.array support + // slice deletion return MP_OBJ_NOT_SUPPORTED; } else { mp_obj_array_t *o = self_in; 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; if (!m_seq_get_fast_slice_indexes(o->len, index_in, &start, &stop)) { assert(0); |