Skip to content

Commit 65c941a

Browse files
authored
fix loadtxt for the case, when built-in complexes are not supported (#666)
1 parent 63dfbd1 commit 65c941a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

code/numpy/io/io.c

+4
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(io_load_obj, io_load);
239239

240240
#if ULAB_NUMPY_HAS_LOADTXT
241241
static void io_assign_value(const char *clipboard, uint8_t len, ndarray_obj_t *ndarray, size_t *idx, uint8_t dtype) {
242+
#if MICROPY_PY_BUILTINS_COMPLEX
242243
mp_obj_t value = mp_parse_num_decimal(clipboard, len, false, false, NULL);
244+
#else
245+
mp_obj_t value = mp_parse_num_float(clipboard, len, false, NULL);
246+
#endif
243247
if(dtype != NDARRAY_FLOAT) {
244248
mp_float_t _value = mp_obj_get_float(value);
245249
value = mp_obj_new_int((int32_t)MICROPY_FLOAT_C_FUN(round)(_value));

code/ulab.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "user/user.h"
3434
#include "utils/utils.h"
3535

36-
#define ULAB_VERSION 6.5.1
36+
#define ULAB_VERSION 6.5.2
3737
#define xstr(s) str(s)
3838
#define str(s) #s
3939

docs/ulab-change-log.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Wed, 6 Mar 2024
2+
3+
version 6.5.2
4+
5+
allow loadtxt to parse numbers, even if built-in complexes are not supported
6+
17
Tue, 9 Jan 2024
28

39
version 6.5.0

0 commit comments

Comments
 (0)