Skip to content

Commit

Permalink
ndarray_from_mp_obj correctly treats Booleans (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
v923z authored May 7, 2023
1 parent beda4c1 commit ac2e995
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions code/ndarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,12 @@ ndarray_obj_t *ndarray_from_mp_obj(mp_obj_t obj, uint8_t other_type) {
ndarray = ndarray_new_linear_array(1, NDARRAY_FLOAT);
mp_float_t *array = (mp_float_t *)ndarray->array;
array[0] = mp_obj_get_float(obj);
} else if(mp_obj_is_bool(obj)) {
ndarray = ndarray_new_linear_array(1, NDARRAY_BOOLEAN);
uint8_t *array = (uint8_t *)ndarray->array;
if(obj == mp_const_true) {
*array = 1;
}
} else if(mp_obj_is_type(obj, &ulab_ndarray_type)){
return MP_OBJ_TO_PTR(obj);
}
Expand Down
2 changes: 1 addition & 1 deletion code/ulab.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "user/user.h"
#include "utils/utils.h"

#define ULAB_VERSION 6.0.11
#define ULAB_VERSION 6.0.12
#define xstr(s) str(s)
#define str(s) #s

Expand Down
6 changes: 6 additions & 0 deletions docs/ulab-change-log.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Sun, 7 May 2023

version 6.0.12

ndarray_from_mp_obj correctly treats Boolean arguments

Sat, 6 May 2023

version 6.0.11
Expand Down

0 comments on commit ac2e995

Please sign in to comment.