diff options
author | Damien George <damien.p.george@gmail.com> | 2018-05-25 17:08:09 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-06-08 11:48:25 +1000 |
commit | bace1a16d056cc755f12f525b9f2bfb3cb4b4b50 (patch) | |
tree | 93bce032a6ca5103d3ff8bfd82a026e6bb067811 /py | |
parent | db5d8c97f1ee74bbd0d5b86991c6de33d0f985b6 (diff) | |
download | micropython-bace1a16d056cc755f12f525b9f2bfb3cb4b4b50.tar.gz micropython-bace1a16d056cc755f12f525b9f2bfb3cb4b4b50.zip |
py/objtype: Don't expose mp_obj_instance_attr().
mp_obj_is_instance_type() can be used instead to check for instance types.
Diffstat (limited to 'py')
-rw-r--r-- | py/objtype.c | 2 | ||||
-rw-r--r-- | py/objtype.h | 3 | ||||
-rw-r--r-- | py/vm.c | 4 |
3 files changed, 3 insertions, 6 deletions
diff --git a/py/objtype.c b/py/objtype.c index 77810ce707..d7d0ed7ff8 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -764,7 +764,7 @@ STATIC bool mp_obj_instance_store_attr(mp_obj_t self_in, qstr attr, mp_obj_t val } } -void mp_obj_instance_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { +STATIC void mp_obj_instance_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { if (dest[0] == MP_OBJ_NULL) { mp_obj_instance_load_attr(self_in, attr, dest); } else { diff --git a/py/objtype.h b/py/objtype.h index 1f43130845..3fc8c6e1b0 100644 --- a/py/objtype.h +++ b/py/objtype.h @@ -42,9 +42,6 @@ typedef struct _mp_obj_instance_t { mp_obj_instance_t *mp_obj_new_instance(const mp_obj_type_t *cls, const mp_obj_type_t **native_base); #endif -// this needs to be exposed for MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE to work -void mp_obj_instance_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest); - // these need to be exposed so mp_obj_is_callable can work correctly bool mp_obj_instance_is_callable(mp_obj_t self_in); mp_obj_t mp_obj_instance_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args); @@ -336,7 +336,7 @@ dispatch_loop: MARK_EXC_IP_SELECTIVE(); DECODE_QSTR; mp_obj_t top = TOP(); - if (mp_obj_get_type(top)->attr == mp_obj_instance_attr) { + if (mp_obj_is_instance_type(mp_obj_get_type(top))) { mp_obj_instance_t *self = MP_OBJ_TO_PTR(top); mp_uint_t x = *ip; mp_obj_t key = MP_OBJ_NEW_QSTR(qst); @@ -434,7 +434,7 @@ dispatch_loop: MARK_EXC_IP_SELECTIVE(); DECODE_QSTR; mp_obj_t top = TOP(); - if (mp_obj_get_type(top)->attr == mp_obj_instance_attr && sp[-1] != MP_OBJ_NULL) { + if (mp_obj_is_instance_type(mp_obj_get_type(top)) && sp[-1] != MP_OBJ_NULL) { mp_obj_instance_t *self = MP_OBJ_TO_PTR(top); mp_uint_t x = *ip; mp_obj_t key = MP_OBJ_NEW_QSTR(qst); |