From c4a8004933d1ae4da52f175d456d6fbe765c3923 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 12 Aug 2016 22:06:47 +0300 Subject: py: Get rid of assert() in method argument checking functions. Checks for number of args removes where guaranteed by function descriptor, self checking is replaced with mp_check_self(). In few cases, exception is raised instead of assert. --- py/objset.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'py/objset.c') diff --git a/py/objset.c b/py/objset.c index 8730918c15..fb89c07f3d 100644 --- a/py/objset.c +++ b/py/objset.c @@ -224,8 +224,6 @@ STATIC mp_obj_t set_discard(mp_obj_t self_in, mp_obj_t item) { STATIC MP_DEFINE_CONST_FUN_OBJ_2(set_discard_obj, set_discard); STATIC mp_obj_t set_diff_int(size_t n_args, const mp_obj_t *args, bool update) { - assert(n_args > 0); - mp_obj_t self; if (update) { check_set(args[0]); @@ -443,8 +441,6 @@ STATIC void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) { } STATIC mp_obj_t set_update(size_t n_args, const mp_obj_t *args) { - assert(n_args > 0); - for (mp_uint_t i = 1; i < n_args; i++) { set_update_int(MP_OBJ_TO_PTR(args[0]), args[i]); } @@ -587,7 +583,7 @@ mp_obj_t mp_obj_new_set(mp_uint_t n_args, mp_obj_t *items) { } void mp_obj_set_store(mp_obj_t self_in, mp_obj_t item) { - assert(MP_OBJ_IS_TYPE(self_in, &mp_type_set)); + mp_check_self(MP_OBJ_IS_TYPE(self_in, &mp_type_set)); mp_obj_set_t *self = MP_OBJ_TO_PTR(self_in); mp_set_lookup(&self->set, item, MP_MAP_LOOKUP_ADD_IF_NOT_FOUND); } -- cgit v1.2.3