summaryrefslogtreecommitdiff
path: root/py/objlist.c
diff options
context:
space:
mode:
authorRoy Hooper <rhooper@toybox.ca>2019-12-13 13:32:58 -0500
committerRoy Hooper <rhooper@toybox.ca>2019-12-13 14:07:53 -0500
commit15072c69c9e940fa5cb0239fc821d2c0353f918e (patch)
treebdf28b09dc976f89df752001b201e7e0b8164522 /py/objlist.c
parentcc31f2d10fd6cf0b96110c7b390e514dc0c3dbc1 (diff)
push changes
Diffstat (limited to 'py/objlist.c')
-rw-r--r--py/objlist.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/py/objlist.c b/py/objlist.c
index c544c27f0..0c0d60aa8 100644
--- a/py/objlist.c
+++ b/py/objlist.c
@@ -160,11 +160,11 @@ STATIC mp_obj_t list_binary_op(mp_binary_op_t op, mp_obj_t lhs, mp_obj_t rhs) {
#pragma GCC diagnostic ignored "-Wunused-parameter"
STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value, mp_obj_t instance) {
+ mp_obj_list_t *self = mp_instance_cast_to_native_base(self_in, &mp_type_list);
if (value == MP_OBJ_NULL) {
// delete
#if MICROPY_PY_BUILTINS_SLICE
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
- mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
mp_bound_slice_t slice;
if (!mp_seq_get_fast_slice_indexes(self->len, index, &slice)) {
mp_raise_NotImplementedError(NULL);
@@ -180,12 +180,11 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value, mp
return mp_const_none;
}
#endif
- mp_obj_t args[2] = {self_in, index};
+ mp_obj_t args[2] = {self, index};
list_pop(2, args);
return mp_const_none;
} else if (value == MP_OBJ_SENTINEL) {
// load
- mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
#if MICROPY_PY_BUILTINS_SLICE
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
mp_bound_slice_t slice;
@@ -202,7 +201,6 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value, mp
} else {
#if MICROPY_PY_BUILTINS_SLICE
if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) {
- mp_obj_list_t *self = MP_OBJ_TO_PTR(self_in);
size_t value_len; mp_obj_t *value_items;
mp_obj_get_array(value, &value_len, &value_items);
mp_bound_slice_t slice_out;
@@ -231,7 +229,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value, mp
return mp_const_none;
}
#endif
- mp_obj_list_store(self_in, index, value);
+ mp_obj_list_store(self, index, value);
return mp_const_none;
}
}