summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-02-01 16:05:37 -0800
committerScott Shawcroft <scott@tannewt.org>2019-02-01 16:05:37 -0800
commit5555a24479a2f40d52d008c991f191d3b9b566bf (patch)
tree0ebb28f8f6b11f3cc6070b74623c227742e3d858
parenta39fc94dde9cd73329130014eb504482591b5a53 (diff)
Never long live the main dictionary.
It's contents change often and may be referenced elsewhere. Fixes #1443
-rwxr-xr-xpy/gc_long_lived.c3
1 files changed, 2 insertions, 1 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.