Skip to content

Commit 643284f

Browse files
committed
Merge branch 'master' of github.com:micropython/micropython
2 parents ff91156 + 2690525 commit 643284f

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

py/gc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ void *gc_realloc(void *ptr_in, machine_uint_t n_bytes) {
480480
}
481481

482482
// compute number of new blocks that are requested
483-
machine_uint_t new_blocks = (n_bytes + BYTES_PER_BLOCK) / BYTES_PER_BLOCK;
483+
machine_uint_t new_blocks = (n_bytes + BYTES_PER_BLOCK - 1) / BYTES_PER_BLOCK;
484484

485485
// get the number of consecutive tail blocks and
486486
// the number of free blocks after last tail block

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)