Skip to content

Commit af5d24f

Browse files
authored
Update ndarray.c
Fix bug in ndarray_tobytes()
1 parent 18c9747 commit af5d24f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

code/ndarray.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1554,7 +1554,7 @@ mp_obj_t ndarray_tobytes(mp_obj_t self_in) {
15541554
if(!ndarray_is_dense(self)) {
15551555
mp_raise_ValueError(translate("tobytes can be invoked for dense arrays only"));
15561556
}
1557-
return mp_obj_new_bytearray_by_ref(self->len, self->array);
1557+
return mp_obj_new_bytearray_by_ref(self->itemsize * self->len, self->array);
15581558
}
15591559

15601560
MP_DEFINE_CONST_FUN_OBJ_1(ndarray_tobytes_obj, ndarray_tobytes);

0 commit comments

Comments
 (0)