diff options
author | Damien George <damien@micropython.org> | 2021-07-14 23:28:25 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2021-07-15 00:12:41 +1000 |
commit | 022b8a7fea5e74b6b83895b2ff555ceab9af478c (patch) | |
tree | 7d03240985f2918cf0e5d71c039352201f1277a7 /py/obj.h | |
parent | 74085f167e09694f1d32d3fb3d212066091f9f7d (diff) |
py/objexcept: Make mp_obj_new_exception_arg1 inline.
This function is rarely used so making it inline reduces code size.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -739,7 +739,6 @@ mp_obj_t mp_obj_new_int_from_float(mp_float_t val); mp_obj_t mp_obj_new_complex(mp_float_t real, mp_float_t imag); #endif mp_obj_t mp_obj_new_exception(const mp_obj_type_t *exc_type); -mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg); mp_obj_t mp_obj_new_exception_args(const mp_obj_type_t *exc_type, size_t n_args, const mp_obj_t *args); #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NONE #define mp_obj_new_exception_msg(exc_type, msg) mp_obj_new_exception(exc_type) @@ -825,6 +824,10 @@ mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in); mp_obj_t mp_obj_exception_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args); mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in); void mp_init_emergency_exception_buf(void); +static inline mp_obj_t mp_obj_new_exception_arg1(const mp_obj_type_t *exc_type, mp_obj_t arg) { + assert(exc_type->make_new == mp_obj_exception_make_new); + return mp_obj_exception_make_new(exc_type, 1, 0, &arg); +} // str bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2); |