summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/dynruntime.h2
-rw-r--r--py/nativeglue.c2
-rw-r--r--py/runtime0.h3
3 files changed, 6 insertions, 1 deletions
diff --git a/py/dynruntime.h b/py/dynruntime.h
index 8564715c0b..90c401ab4b 100644
--- a/py/dynruntime.h
+++ b/py/dynruntime.h
@@ -79,7 +79,7 @@ static inline void *m_realloc_dyn(void *ptr, size_t new_num_bytes) {
/******************************************************************************/
// Types and objects
-#define MP_OBJ_NEW_QSTR(x) MP_OBJ_NEW_QSTR_##x
+#define MP_OBJ_NEW_QSTR(x) (mp_fun_table.native_to_obj(x, MP_NATIVE_TYPE_QSTR))
#define mp_type_type (*mp_fun_table.type_type)
#define mp_type_NoneType (*mp_obj_get_type(mp_const_none))
diff --git a/py/nativeglue.c b/py/nativeglue.c
index 743ff38ccb..d92d815abd 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -104,6 +104,8 @@ mp_obj_t mp_native_to_obj(mp_uint_t val, mp_uint_t type) {
return mp_obj_new_int(val);
case MP_NATIVE_TYPE_UINT:
return mp_obj_new_int_from_uint(val);
+ case MP_NATIVE_TYPE_QSTR:
+ return MP_OBJ_NEW_QSTR(val);
default: // a pointer
// we return just the value of the pointer as an integer
return mp_obj_new_int_from_uint(val);
diff --git a/py/runtime0.h b/py/runtime0.h
index 6ef2d727c1..69af38ddcb 100644
--- a/py/runtime0.h
+++ b/py/runtime0.h
@@ -50,6 +50,9 @@
#define MP_NATIVE_TYPE_PTR16 (0x06)
#define MP_NATIVE_TYPE_PTR32 (0x07)
+// Not use for viper, but for dynamic native modules
+#define MP_NATIVE_TYPE_QSTR (0x08)
+
// Bytecode and runtime boundaries for unary ops
#define MP_UNARY_OP_NUM_BYTECODE (MP_UNARY_OP_NOT + 1)
#define MP_UNARY_OP_NUM_RUNTIME (MP_UNARY_OP_SIZEOF + 1)