summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/py/runtime.c b/py/runtime.c
index ce71025a8c..41d696a2e3 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -514,7 +514,7 @@ py_obj_t py_builtin___build_class__(py_obj_t o_class_fun, py_obj_t o_class_name)
}
py_obj_t py_builtin_range(py_obj_t o_arg) {
- return py_obj_new_range(0, rt_get_int(o_arg), 1);
+ return py_obj_new_range(0, py_get_int(o_arg), 1);
}
#ifdef WRITE_NATIVE
@@ -845,7 +845,7 @@ int rt_is_true(py_obj_t arg) {
}
}
-int rt_get_int(py_obj_t arg) {
+int py_get_int(py_obj_t arg) {
if (arg == py_const_false) {
return 0;
} else if (arg == py_const_true) {
@@ -858,6 +858,15 @@ int rt_get_int(py_obj_t arg) {
}
}
+qstr py_get_qstr(py_obj_t arg) {
+ if (IS_O(arg, O_STR)) {
+ return ((py_obj_base_t*)arg)->u_str;
+ } else {
+ assert(0);
+ return 0;
+ }
+}
+
py_obj_t rt_load_const_str(qstr qstr) {
DEBUG_OP_printf("load '%s'\n", qstr_str(qstr));
return py_obj_new_str(qstr);