diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-20 19:08:46 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-20 19:08:46 +0100 |
commit | 643284fc8e7cec935f13c50ecde854932a28cee8 (patch) | |
tree | 08213b7883172644d31307f5e1a7e59ddc6ba2e9 /py | |
parent | ff91156d3495c3583dd4ced85ceea6243a1377a2 (diff) | |
parent | 26905259d04ffa2ee9b1be2607bd680a40d8dfbe (diff) | |
download | micropython-643284fc8e7cec935f13c50ecde854932a28cee8.tar.gz micropython-643284fc8e7cec935f13c50ecde854932a28cee8.zip |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py')
-rw-r--r-- | py/gc.c | 2 | ||||
-rw-r--r-- | py/objarray.c | 8 |
2 files changed, 9 insertions, 1 deletions
@@ -480,7 +480,7 @@ void *gc_realloc(void *ptr_in, machine_uint_t n_bytes) { } // compute number of new blocks that are requested - machine_uint_t new_blocks = (n_bytes + BYTES_PER_BLOCK) / BYTES_PER_BLOCK; + machine_uint_t new_blocks = (n_bytes + BYTES_PER_BLOCK - 1) / BYTES_PER_BLOCK; // get the number of consecutive tail blocks and // the number of free blocks after last tail block 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); |