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:
Jim Mussared
2022-08-23 18:35:37 +10:00
committed by Damien George
parent 88864587f5
commit 3a910b1565
8 changed files with 19 additions and 7 deletions

View File

@@ -160,7 +160,7 @@ value_error:
mp_printf(&print, "invalid syntax for integer with base %d: ", base);
mp_str_print_quoted(&print, str_val_start, top - str_val_start, true);
mp_obj_t exc = mp_obj_new_exception_arg1(&mp_type_ValueError,
mp_obj_new_str_from_vstr(&vstr));
mp_obj_new_str_from_utf8_vstr(&vstr));
raise_exc(exc, lex);
#endif
}