push changes

This commit is contained in:
Roy Hooper 2019-12-13 13:32:58 -05:00
parent cc31f2d10f
commit 15072c69c9
4 changed files with 15 additions and 10 deletions

View File

@ -248,7 +248,8 @@ STATIC mp_obj_t btree_iternext(mp_obj_t self_in) {
#pragma GCC diagnostic ignored "-Wunused-parameter"
STATIC mp_obj_t btree_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value, mp_obj_t instance) {
mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in);
//mp_obj_btree_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_btree_t *self = mp_instance_cast_to_native_base(self_in, &btree_type);
if (value == MP_OBJ_NULL) {
// delete
DBT key;

View File

@ -519,8 +519,8 @@ STATIC void uctypes_struct_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
}
#pragma GCC diagnostic ignored "-Wunused-parameter"
STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value, mp_obj_t instance) {
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_obj_t value, mp_obj_t instance) {
mp_obj_uctypes_struct_t *self = mp_instance_cast_to_native_base(base_in, &uctypes_struct_type);
if (value == MP_OBJ_NULL) {
// delete

View File

@ -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;
}
}

View File

@ -34,6 +34,7 @@
#include "py/objtype.h"
#include "py/runtime.h"
#include "supervisor/shared/stack.h"
#include "supervisor/shared/translate.h"
#if MICROPY_DEBUG_VERBOSE // print debugging info
@ -851,8 +852,13 @@ STATIC mp_obj_t instance_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value
mp_obj_class_lookup(&lookup, self->base.type);
meth_args = 3;
}
if (member[0] == MP_OBJ_SENTINEL) {
return mp_obj_subscr(self->subobj[0], index, value, instance);
if (member[0] == MP_OBJ_SENTINEL) { // native base subscr exists
mp_obj_type_t *subobj_type = mp_obj_get_type(self->subobj[0]);
// return mp_obj_subscr(self->subobj[0], index, value, instance);
mp_obj_t ret = subobj_type->subscr(self_in, index, value, instance);
// May have called port specific C code. Make sure it didn't mess up the heap.
assert_heap_ok();
return ret;
} else if (member[0] != MP_OBJ_NULL) {
mp_obj_t args[3] = {self_in, index, value};
// TODO probably need to call mp_convert_member_lookup, and use mp_call_method_n_kw