summaryrefslogtreecommitdiff
path: root/py/runtime.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-02-07 17:24:10 +0000
committerDamien George <damien.p.george@gmail.com>2015-02-07 17:24:10 +0000
commite1e359ff59d6bbf09441cc1f3965be63f1046182 (patch)
treec7c05b27f535ebf52fe52fcea9e7fb0b07f18e28 /py/runtime.h
parent8785645a952c03315dbf93667b5f7c7eec49762f (diff)
py: Put mp_sys_path, mp_sys_argv and gc_collected in mp_state_ctx_t.
Without mp_sys_path and mp_sys_argv in the root pointer section of the state, their memory was being incorrectly collected by GC.
Diffstat (limited to 'py/runtime.h')
-rw-r--r--py/runtime.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/py/runtime.h b/py/runtime.h
index a4386b4bb..e09162433 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -125,10 +125,8 @@ mp_obj_t mp_convert_native_to_obj(mp_uint_t val, mp_uint_t type);
mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, mp_uint_t n_args_kw, const mp_obj_t *args);
void mp_native_raise(mp_obj_t o);
-extern struct _mp_obj_list_t mp_sys_path_obj;
-extern struct _mp_obj_list_t mp_sys_argv_obj;
-#define mp_sys_path ((mp_obj_t)&mp_sys_path_obj)
-#define mp_sys_argv ((mp_obj_t)&mp_sys_argv_obj)
+#define mp_sys_path ((mp_obj_t)&MP_STATE_VM(mp_sys_path_obj))
+#define mp_sys_argv ((mp_obj_t)&MP_STATE_VM(mp_sys_argv_obj))
#if MICROPY_WARNINGS
void mp_warning(const char *msg, ...);