diff options
Diffstat (limited to 'py')
| -rwxr-xr-x | py/gc_long_lived.c | 3 | ||||
| -rw-r--r-- | py/objtype.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/py/gc_long_lived.c b/py/gc_long_lived.c index 3c54de7ed..49bf1fcd7 100755 --- a/py/gc_long_lived.c +++ b/py/gc_long_lived.c @@ -27,6 +27,7 @@ #include "py/emitglue.h" #include "py/gc_long_lived.h" #include "py/gc.h" +#include "py/mpstate.h" mp_obj_fun_bc_t *make_fun_bc_long_lived(mp_obj_fun_bc_t *fun_bc, uint8_t max_depth) { #ifndef MICROPY_ENABLE_GC @@ -88,7 +89,7 @@ mp_obj_dict_t *make_dict_long_lived(mp_obj_dict_t *dict, uint8_t max_depth) { #ifndef MICROPY_ENABLE_GC return dict; #endif - if (dict == NULL || max_depth == 0) { + if (dict == NULL || max_depth == 0 || dict == &MP_STATE_VM(dict_main)) { return dict; } // Don't recurse unnecessarily. Return immediately if we've already seen this dict. diff --git a/py/objtype.c b/py/objtype.c index f7fe3b3f6..fec99da1a 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -1065,7 +1065,7 @@ STATIC void type_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { // store attribute mp_map_elem_t *elem = mp_map_lookup(locals_map, MP_OBJ_NEW_QSTR(attr), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND); - elem->value = make_obj_long_lived(dest[1], 10); + elem->value = dest[1]; dest[0] = MP_OBJ_NULL; // indicate success } } |
