fix string construction

This commit is contained in:
Jeff Epler 2023-09-22 13:53:56 -05:00
parent ea5bc12a07
commit 1c09a0b494
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
3 changed files with 3 additions and 3 deletions

View File

@ -73,7 +73,7 @@ STATIC mp_obj_t struct_pack(size_t n_args, const mp_obj_t *args) {
memset(p, 0, size);
byte *end_p = &p[size];
shared_modules_struct_pack_into(args[0], p, end_p, n_args - 1, &args[1]);
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
return mp_obj_new_bytes_from_vstr(&vstr);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(struct_pack_obj, 1, MP_OBJ_FUN_ARGS_MAX, struct_pack);

View File

@ -158,7 +158,7 @@ STATIC mp_obj_t traceback_format_exception(size_t n_args, const mp_obj_t *pos_ar
vstr_t vstr;
vstr_init_print(&vstr, 0, &print);
traceback_exception_common(false, &print, n_args, pos_args, kw_args);
mp_obj_t output = mp_obj_new_str_from_vstr(&mp_type_str, &vstr);
mp_obj_t output = mp_obj_new_str_from_vstr(&vstr);
return mp_obj_new_list(1, &output);
}

View File

@ -392,7 +392,7 @@ mp_obj_t common_hal_os_getenv_path(const char *path, const char *key, mp_obj_t d
handle_getenv_error(result, mp_raise_msg_varg);
if (quoted) {
return mp_obj_new_str_from_vstr(&mp_type_str, &buf);
return mp_obj_new_str_from_vstr(&buf);
} else {
return mp_parse_num_integer(buf.buf, buf.len, 0, NULL);
}