summaryrefslogtreecommitdiff
path: root/py/parsenum.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-06-25 04:10:34 +0100
committerDamien George <damien.p.george@gmail.com>2014-06-25 04:10:34 +0100
commite973acde81462de0c205f27db2642a08022fb3a8 (patch)
treec6862ead76ae12979b3c3d6d1ec20774884c72ef /py/parsenum.c
parent780e54cdc3491409060f90003ca64fcdd3f9f1e6 (diff)
parent939c2e7f448fbe6b44d0079d2fc33c7ac7eb32d0 (diff)
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/parsenum.c')
-rw-r--r--py/parsenum.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/py/parsenum.c b/py/parsenum.c
index 1c1868ae0..b9801ab6a 100644
--- a/py/parsenum.c
+++ b/py/parsenum.c
@@ -27,14 +27,15 @@
#include <stdbool.h>
#include <stdlib.h>
-#include "misc.h"
#include "mpconfig.h"
+#include "misc.h"
#include "qstr.h"
#include "nlr.h"
#include "obj.h"
#include "parsenumbase.h"
#include "parsenum.h"
#include "smallint.h"
+#include "runtime.h"
#if MICROPY_PY_BUILTINS_FLOAT
#include <math.h>
@@ -252,10 +253,15 @@ mp_obj_t mp_parse_num_decimal(const char *str, uint len, bool allow_imag, bool f
}
// return the object
+#if MICROPY_PY_BUILTINS_COMPLEX
if (imag) {
return mp_obj_new_complex(0, dec_val);
} else if (force_complex) {
return mp_obj_new_complex(dec_val, 0);
+#else
+ if (imag || force_complex) {
+ mp_not_implemented("complex values not supported");
+#endif
} else {
return mp_obj_new_float(dec_val);
}