diff options
Diffstat (limited to 'py/objdict.c')
-rw-r--r-- | py/objdict.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/py/objdict.c b/py/objdict.c index 93ff1af90a..f78a7358b2 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -46,7 +46,8 @@ static mp_obj_t dict_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp static mp_obj_t dict_unary_op(int op, mp_obj_t self_in) { mp_obj_dict_t *self = self_in; switch (op) { - case RT_UNARY_OP_NOT: if (self->map.used == 0) { return mp_const_true; } else { return mp_const_false; } + case RT_UNARY_OP_BOOL: return MP_BOOL(self->map.used != 0); + case RT_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(self->map.used); default: return MP_OBJ_NULL; // op not supported for None } } |