esp8266/moduos: Populate release field of uname in case it was GC'd.
This commit is contained in:
parent
f92f7dd2bc
commit
39100dc377
@ -58,10 +58,9 @@ STATIC mp_obj_tuple_t os_uname_info_obj = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
STATIC mp_obj_t os_uname(void) {
|
STATIC mp_obj_t os_uname(void) {
|
||||||
if (os_uname_info_obj.items[2] == NULL) {
|
// We must populate the "release" field each time in case it was GC'd since the last call.
|
||||||
const char *ver = system_get_sdk_version();
|
const char *ver = system_get_sdk_version();
|
||||||
os_uname_info_obj.items[2] = mp_obj_new_str(ver, strlen(ver), false);
|
os_uname_info_obj.items[2] = mp_obj_new_str(ver, strlen(ver), false);
|
||||||
}
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
return (mp_obj_t)&os_uname_info_obj;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
|
||||||
|
Loading…
Reference in New Issue
Block a user