py/objtype: Don't expose mp_obj_instance_attr().
mp_obj_is_instance_type() can be used instead to check for instance types.
This commit is contained in:
parent
db5d8c97f1
commit
bace1a16d0
@ -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 {
|
||||
|
@ -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);
|
||||
|
4
py/vm.c
4
py/vm.c
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user