8000 py/persistentcode: Allow to compile with complex numbers disabled. · DFRobot/micropython@72732fe · GitHub
[go: up one dir, main page]

Skip to content

Commit 72732fe

Browse files
committed
py/persistentcode: Allow to compile with complex numbers disabled.
1 parent 4d2778c commit 72732fe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

py/persistentcode.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,13 @@ STATIC void save_obj(mp_print_t *print, mp_obj_t o) {
286286
byte obj_type;
287287
if (MP_OBJ_IS_TYPE(o, &mp_type_int)) {
288288
obj_type = 'i';
289-
} else if (mp_obj_is_float(o)) {
290-
obj_type = 'f';
291-
} else {
292-
assert(MP_OBJ_IS_TYPE(o, &mp_type_complex));
289+
#if MICROPY_PY_BUILTINS_COMPLEX
290+
} else if (MP_OBJ_IS_TYPE(o, &mp_type_complex)) {
293291
obj_type = 'c';
292+
#endif
293+
} else {
294+
assert(mp_obj_is_float(o));
295+
obj_type = 'f';
294296
}
295297
vstr_t vstr;
296298
mp_print_t pr;

0 commit comments

Comments
 (0)
0