Skip to content

Commit

Permalink
fix loadtxt for the case, when built-in complexes are not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
v923z committed Mar 6, 2024
1 parent 63dfbd1 commit 3d138cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions code/numpy/io/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(io_load_obj, io_load);

#if ULAB_NUMPY_HAS_LOADTXT
static void io_assign_value(const char *clipboard, uint8_t len, ndarray_obj_t *ndarray, size_t *idx, uint8_t dtype) {
#if MICROPY_PY_BUILTINS_COMPLEX
mp_obj_t value = mp_parse_num_decimal(clipboard, len, false, false, NULL);
#else
mp_obj_t value = mp_parse_num_float(clipboard, len, false, NULL);
#endif
if(dtype != NDARRAY_FLOAT) {
mp_float_t _value = mp_obj_get_float(value);
value = mp_obj_new_int((int32_t)MICROPY_FLOAT_C_FUN(round)(_value));
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.5.1
#define ULAB_VERSION 6.5.2
#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 @@
Wed, 6 Mar 2024

version 6.5.2

allow loadtxt to parse numbers, even if built-in complexes are not supported

Tue, 9 Jan 2024

version 6.5.0
Expand Down

0 comments on commit 3d138cc

Please sign in to comment.