summaryrefslogtreecommitdiff
path: root/py/runtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c
index e6d8c6807..2c3b3ddde 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -319,6 +319,15 @@ mp_obj_t mp_unary_op(mp_unary_op_t op, mp_obj_t arg) {
// if arg==mp_const_none.
return mp_const_true;
}
+ #if MICROPY_PY_BUILTINS_FLOAT
+ if (op == MP_UNARY_OP_FLOAT_MAYBE
+ #if MICROPY_PY_BUILTINS_COMPLEX
+ || op == MP_UNARY_OP_COMPLEX_MAYBE
+ #endif
+ ) {
+ return MP_OBJ_NULL;
+ }
+ #endif
// With MP_UNARY_OP_INT, mp_unary_op() becomes a fallback for mp_obj_get_int().
// In this case provide a more focused error message to not confuse, e.g. chr(1.0)
#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE