diff options
Diffstat (limited to 'py/builtin.c')
| -rw-r--r-- | py/builtin.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/py/builtin.c b/py/builtin.c index 88a724fcd..1924e6080 100644 --- a/py/builtin.c +++ b/py/builtin.c @@ -99,7 +99,7 @@ STATIC mp_obj_t mp_builtin___repl_print__(mp_obj_t o) { MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin___repl_print___obj, mp_builtin___repl_print__); -mp_obj_t mp_builtin_abs(mp_obj_t o_in) { +STATIC mp_obj_t mp_builtin_abs(mp_obj_t o_in) { if (MP_OBJ_IS_SMALL_INT(o_in)) { mp_int_t val = MP_OBJ_SMALL_INT_VALUE(o_in); if (val < 0) { @@ -284,17 +284,6 @@ STATIC mp_obj_t mp_builtin_iter(mp_obj_t o_in) { MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_iter_obj, mp_builtin_iter); -STATIC mp_obj_t mp_builtin_len(mp_obj_t o_in) { - mp_obj_t len = mp_obj_len_maybe(o_in); - if (len == NULL) { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "object of type '%s' has no len()", mp_obj_get_type_str(o_in))); - } else { - return len; - } -} - -MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_len_obj, mp_builtin_len); - STATIC mp_obj_t mp_builtin_max(uint n_args, const mp_obj_t *args) { if (n_args == 1) { // given an iterable @@ -569,6 +558,7 @@ STATIC mp_obj_t mp_builtin_hasattr(mp_obj_t object_in, mp_obj_t attr_in) { MP_DEFINE_CONST_FUN_OBJ_2(mp_builtin_hasattr_obj, mp_builtin_hasattr); -// These two are defined in terms of MicroPython API functions right away +// These are defined in terms of MicroPython API functions right away +MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_len_obj, mp_obj_len); MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_globals_obj, mp_globals_get); MP_DEFINE_CONST_FUN_OBJ_0(mp_builtin_locals_obj, mp_locals_get); |
