From 999cedb90ff0827cdb9dfe0e4faa6ebc1739d271 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 27 Nov 2015 17:01:44 +0000 Subject: 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. --- py/repl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'py/repl.c') diff --git a/py/repl.c b/py/repl.c index 440606996..182961b4b 100644 --- a/py/repl.c +++ b/py/repl.c @@ -169,11 +169,11 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t } 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 -- cgit v1.2.3