py: Add MP_OBJ_STOP_ITERATION and make good use of it.

Also make consistent use of MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL.
This helps a lot in debugging and understanding of function API.
This commit is contained in:
Damien George
2014-04-17 23:19:36 +01:00
parent 1e935d8689
commit ea8d06c39d
28 changed files with 130 additions and 121 deletions

View File

@@ -193,7 +193,7 @@ bool mp_obj_int_is_positive(mp_obj_t self_in) {
// This is called for operations on SMALL_INT that are not handled by mp_unary_op
mp_obj_t mp_obj_int_unary_op(int op, mp_obj_t o_in) {
return MP_OBJ_NULL;
return MP_OBJ_NOT_SUPPORTED;
}
// This is called for operations on SMALL_INT that are not handled by mp_binary_op
@@ -262,7 +262,7 @@ mp_obj_t mp_obj_int_binary_op_extra_cases(int op, mp_obj_t lhs_in, mp_obj_t rhs_
return mp_binary_op(op, rhs_in, lhs_in);
}
}
return MP_OBJ_NULL;
return MP_OBJ_NOT_SUPPORTED;
}
// this is a classmethod