diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-02-24 15:13:07 +0100 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-02-24 15:13:07 +0100 |
| commit | 12fa5b3a66d6f0034113a56c7d647c7bac5be74c (patch) | |
| tree | cc4d5103421f930b7ebaa20eb7d6c8d59c6b6f0d /py/objint.c | |
| parent | efd429464ed82c78fd2e11244a803c7ec2cb2211 (diff) | |
Switch exception throwing to mp_raise helpers. It saves a little code space each time to share the call.
Diffstat (limited to 'py/objint.c')
| -rw-r--r-- | py/objint.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/py/objint.c b/py/objint.c index 5842a00a4..edb2ecd87 100644 --- a/py/objint.c +++ b/py/objint.c @@ -322,15 +322,15 @@ mp_obj_t mp_obj_new_int_from_uint(mp_uint_t value) { mp_obj_t mp_obj_new_int_from_float(mp_float_t val) { int cl = fpclassify(val); if (cl == FP_INFINITE) { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OverflowError, "can't convert inf to int")); + mp_raise_msg(&mp_type_OverflowError, "can't convert inf to int"); } else if (cl == FP_NAN) { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "can't convert NaN to int")); + mp_raise_ValueError("can't convert NaN to int"); } else { mp_fp_as_int_class_t icl = mp_classify_fp_as_int(val); if (icl == MP_FP_CLASS_FIT_SMALLINT) { return MP_OBJ_NEW_SMALL_INT((mp_int_t)val); } else { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "float too big")); + mp_raise_ValueError("float too big"); } } } @@ -380,7 +380,7 @@ STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) { (void)n_args; if (args[2] != MP_OBJ_NEW_QSTR(MP_QSTR_little)) { - mp_not_implemented(""); + mp_raise_NotImplementError(""); } // get the buffer info @@ -405,7 +405,7 @@ STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *args) { (void)n_args; if (args[2] != MP_OBJ_NEW_QSTR(MP_QSTR_little)) { - mp_not_implemented(""); + mp_raise_NotImplementError(""); } mp_uint_t len = MP_OBJ_SMALL_INT_VALUE(args[1]); |
