diff options
Diffstat (limited to 'py/objstr.c')
-rw-r--r-- | py/objstr.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/py/objstr.c b/py/objstr.c index fc1e1c5695..7de42b6e9e 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -579,7 +579,7 @@ static mp_obj_t arg_as_int(mp_obj_t arg) { return arg; } -mp_obj_t str_format(uint n_args, const mp_obj_t *args) { +mp_obj_t mp_obj_str_format(uint n_args, const mp_obj_t *args) { assert(MP_OBJ_IS_STR(args[0])); GET_STR_DATA_LEN(args[0], str, len); @@ -1346,7 +1346,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(str_join_obj, str_join); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_split_obj, 1, 3, str_split); STATIC MP_DEFINE_CONST_FUN_OBJ_2(str_startswith_obj, str_startswith); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_strip_obj, 1, 2, str_strip); -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(str_format_obj, 1, str_format); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR(str_format_obj, 1, mp_obj_str_format); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_replace_obj, 3, 4, str_replace); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(str_count_obj, 2, 4, str_count); STATIC MP_DEFINE_CONST_FUN_OBJ_2(str_partition_obj, str_partition); @@ -1485,7 +1485,8 @@ uint mp_obj_str_get_hash(mp_obj_t self_in) { } uint mp_obj_str_get_len(mp_obj_t self_in) { - if (MP_OBJ_IS_STR(self_in)) { + // TODO This has a double check for the type, one in obj.c and one here + if (MP_OBJ_IS_STR(self_in) || MP_OBJ_IS_TYPE(self_in, &mp_type_bytes)) { GET_STR_LEN(self_in, l); return l; } else { |