py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.
This allows the mp_obj_t type to be configured to something other than a
pointer-sized primitive type.
This patch also includes additional changes to allow the code to compile
when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of
mp_uint_t, and various casts.
diff --git a/py/repl.c b/py/repl.c
index 4406069..182961b 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -169,11 +169,11 @@
} else {
mp_obj_type_t *type;
if (MP_OBJ_IS_TYPE(obj, &mp_type_type)) {
- type = obj;
+ type = MP_OBJ_TO_PTR(obj);
} else {
type = mp_obj_get_type(obj);
}
- if (type->locals_dict != MP_OBJ_NULL && MP_OBJ_IS_TYPE(type->locals_dict, &mp_type_dict)) {
+ if (type->locals_dict != NULL && type->locals_dict->base.type == &mp_type_dict) {
dict = type->locals_dict;
} else {
// obj has no dict