py/objstr: Optimise mp_obj_new_str_from_vstr for known-safe strings.
The new `mp_obj_new_str_from_utf8_vstr` can be used when you know you already have a unicode-safe string. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
committed by
Damien George
parent
88864587f5
commit
3a910b1565
@@ -373,7 +373,7 @@ STATIC mp_obj_t re_sub_helper(size_t n_args, const mp_obj_t *args) {
|
||||
vstr_add_strn(&vstr_return, subj.begin, subj.end - subj.begin);
|
||||
|
||||
if (mp_obj_get_type(where) == &mp_type_str) {
|
||||
return mp_obj_new_str_from_vstr(&vstr_return);
|
||||
return mp_obj_new_str_from_utf8_vstr(&vstr_return);
|
||||
} else {
|
||||
return mp_obj_new_bytes_from_vstr(&vstr_return);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user