diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-02 17:06:05 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-02 17:06:05 +0100 |
commit | 70f33cde48524f12f2110c7daa4a874a6828314a (patch) | |
tree | 1b7796186661b7a9a96f9480997310cca046ee2f /py/objstr.c | |
parent | af6edc61bd51b58c2cac4411bd471e7cf4649a3c (diff) |
py: Fix up so that it can compile without float.
Diffstat (limited to 'py/objstr.c')
-rw-r--r-- | py/objstr.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/py/objstr.c b/py/objstr.c index 8389bb0bd..f22c6b1ba 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -788,9 +788,9 @@ mp_obj_t str_format(uint n_args, const mp_obj_t *args) { nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Unknown format code '%c' for object of type '%s'", type, mp_obj_get_type_str(arg))); } - } + #if MICROPY_ENABLE_FLOAT - if (arg_looks_numeric(arg)) { + } else if (arg_looks_numeric(arg)) { if (!type) { // Even though the docs say that an unspecified type is the same @@ -848,10 +848,14 @@ mp_obj_t str_format(uint n_args, const mp_obj_t *args) { type, mp_obj_get_type_str(arg))); } #endif + } else { + // arg doesn't look like a number + if (align == '=') { nlr_jump(mp_obj_new_exception_msg(&mp_type_ValueError, "'=' alignment not allowed in string format specifier")); } + switch (type) { case '\0': mp_obj_print_helper((void (*)(void*, const char*, ...))vstr_printf, vstr, arg, PRINT_STR); |