Skip to content

Commit f477bfb

Browse files
committed
Pre-create sys module.
1 parent bb33cc6 commit f477bfb

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

py/runtime.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,11 @@ void rt_init(void) {
155155
#if MICROPY_CPYTHON_COMPAT
156156
// Add (empty) micropython module, so it was possible to "import micropython",
157157
// which can be a placeholder module on CPython.
158-
mp_obj_t m = mp_obj_new_module(qstr_from_str_static("micropython"));
159-
rt_store_name(qstr_from_str_static("micropython"), m);
158+
mp_obj_t m_mp = mp_obj_new_module(qstr_from_str_static("micropython"));
159+
rt_store_name(qstr_from_str_static("micropython"), m_mp);
160+
161+
mp_obj_t m_sys = mp_obj_new_module(qstr_from_str_static("sys"));
162+
rt_store_name(qstr_from_str_static("sys"), m_sys);
160163
#endif
161164

162165
next_unique_code_id = 1; // 0 indicates "no code"

0 commit comments

Comments
 (0)