summaryrefslogtreecommitdiff
path: root/py/parsenum.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-11-06 17:36:16 +0000
committerDamien George <damien.p.george@gmail.com>2014-11-06 17:36:16 +0000
commit1e9a92f84fb58db610e20b766052292edc28d25b (patch)
tree0005072b03a413c4b01df72f61066e0aaeca23f3 /py/parsenum.c
parentb6b34cd3f6585eed455473bc149e9db758a45d9c (diff)
py: Use shorter, static error msgs when ERROR_REPORTING_TERSE enabled.
Going from MICROPY_ERROR_REPORTING_NORMAL to MICROPY_ERROR_REPORTING_TERSE now saves 2020 bytes ROM for ARM Thumb2, and 2200 bytes ROM for 32-bit x86. This is about a 2.5% code size reduction for bare-arm.
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 f7f43ac9b..bb88eb729 100644
--- a/py/parsenum.c
+++ b/py/parsenum.c
@@ -138,7 +138,13 @@ overflow:
}
value_error:
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "invalid syntax for integer with base %d: '%s'", base, str));
+ if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
+ nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError,
+ "invalid syntax for integer"));
+ } else {
+ nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError,
+ "invalid syntax for integer with base %d: '%s'", base, str));
+ }
}
typedef enum {