use base for errors

This commit is contained in:
Roy Hooper 2019-11-23 12:15:12 -05:00
parent c770ccd939
commit 27979f51ac

View File

@ -507,21 +507,21 @@ mp_obj_t mp_obj_subscr_impl(mp_obj_t base, mp_obj_t index, mp_obj_t value, mp_ob
mp_raise_TypeError(translate("object does not support item deletion")); mp_raise_TypeError(translate("object does not support item deletion"));
} else { } else {
mp_raise_TypeError_varg( mp_raise_TypeError_varg(
translate("'%s' object does not support item deletion"), mp_obj_get_type_str(instance)); translate("'%s' object does not support item deletion"), mp_obj_get_type_str(base));
} }
} else if (value == MP_OBJ_SENTINEL) { } else if (value == MP_OBJ_SENTINEL) {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
mp_raise_TypeError(translate("object is not subscriptable")); mp_raise_TypeError(translate("object is not subscriptable"));
} else { } else {
mp_raise_TypeError_varg( mp_raise_TypeError_varg(
translate("'%s' object is not subscriptable"), mp_obj_get_type_str(instance)); translate("'%s' object is not subscriptable"), mp_obj_get_type_str(base));
} }
} else { } else {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
mp_raise_TypeError(translate("object does not support item assignment")); mp_raise_TypeError(translate("object does not support item assignment"));
} else { } else {
mp_raise_TypeError_varg( mp_raise_TypeError_varg(
translate("'%s' object does not support item assignment"), mp_obj_get_type_str(instance)); translate("'%s' object does not support item assignment"), mp_obj_get_type_str(base));
} }
} }
} }