summaryrefslogtreecommitdiff
path: root/unix/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/unix/main.c b/unix/main.c
index 7f92814aa..facc250a7 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -6,6 +6,7 @@
#include "nlr.h"
#include "misc.h"
#include "mpconfig.h"
+#include "qstr.h"
#include "lexer.h"
#include "lexerunix.h"
#include "parse.h"
@@ -217,11 +218,12 @@ int main(int argc, char **argv) {
qstr_init();
rt_init();
- mp_obj_t m_sys = mp_obj_new_module(qstr_from_str_static("sys"));
+ mp_obj_t m_sys = mp_obj_new_module(MP_QSTR_sys);
mp_obj_t py_argv = mp_obj_new_list(0, NULL);
- rt_store_attr(m_sys, qstr_from_str_static("argv"), py_argv);
+ rt_store_attr(m_sys, MP_QSTR_argv, py_argv);
+
+ rt_store_name(qstr_from_str("test"), test_obj_new(42));
- rt_store_name(qstr_from_str_static("test"), test_obj_new(42));
file_init();
rawsocket_init();
@@ -233,9 +235,9 @@ int main(int argc, char **argv) {
// test_obj = TestClass()
// test_obj.attr = 42
mp_obj_t test_class_type, test_class_instance;
- test_class_type = mp_obj_new_type(qstr_from_str_static("TestClass"), mp_const_empty_tuple, mp_obj_new_dict(0));
- rt_store_name(qstr_from_str_static("test_obj"), test_class_instance = rt_call_function_0(test_class_type));
- rt_store_attr(test_class_instance, qstr_from_str_static("attr"), mp_obj_new_int(42));
+ test_class_type = mp_obj_new_type(QSTR_FROM_STR_STATIC("TestClass"), mp_const_empty_tuple, mp_obj_new_dict(0));
+ rt_store_name(QSTR_FROM_STR_STATIC("test_obj"), test_class_instance = rt_call_function_0(test_class_type));
+ rt_store_attr(test_class_instance, QSTR_FROM_STR_STATIC("attr"), mp_obj_new_int(42));
/*
printf("bytes:\n");
@@ -260,7 +262,7 @@ int main(int argc, char **argv) {
}
} else {
for (int i = a; i < argc; i++) {
- rt_list_append(py_argv, MP_OBJ_NEW_QSTR(qstr_from_strn_copy(argv[i], strlen(argv[i]))));
+ rt_list_append(py_argv, MP_OBJ_NEW_QSTR(qstr_from_str(argv[i])));
}
do_file(argv[a]);
break;