File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import sys
2+ print (sys .argv )
Original file line number Diff line number Diff line change @@ -216,6 +216,10 @@ int main(int argc, char **argv) {
216216 qstr_init ();
217217 rt_init ();
218218
219+ mp_obj_t m_sys = mp_obj_new_module (qstr_from_str_static ("sys" ));
220+ mp_obj_t py_argv = mp_obj_new_list (0 , NULL );
221+ rt_store_attr (m_sys , qstr_from_str_static ("argv" ), py_argv );
222+
219223 rt_store_name (qstr_from_str_static ("test" ), test_obj_new (42 ));
220224 rt_store_name (qstr_from_str_static ("open" ), (mp_obj_t )& mp_builtin_open_obj );
221225 rawsocket_init ();
@@ -254,7 +258,11 @@ int main(int argc, char **argv) {
254258 return usage ();
255259 }
256260 } else {
261+ for (int i = a ; i < argc ; i ++ ) {
262+ rt_list_append (py_argv , MP_OBJ_NEW_QSTR (qstr_from_strn_copy (argv [i ], strlen (argv [i ]))));
263+ }
257264 do_file (argv [a ]);
265+ break ;
258266 }
259267 }
260268 }
You can’t perform that action at this time.
0 commit comments