summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/py/obj.c b/py/obj.c
index 77580e1fee..7d0122c8fe 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -13,6 +13,15 @@
#include "runtime.h"
#include "map.h"
+mp_obj_t mp_obj_get_type(mp_obj_t o_in) {
+ if (MP_OBJ_IS_SMALL_INT(o_in)) {
+ return (mp_obj_t)&int_type;
+ } else {
+ mp_obj_base_t *o = o_in;
+ return (mp_obj_t)o->type;
+ }
+}
+
const char *mp_obj_get_type_str(mp_obj_t o_in) {
if (MP_OBJ_IS_SMALL_INT(o_in)) {
return "int";