diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-30 01:29:32 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-30 01:29:32 -0800 |
commit | b25711ea8fdc1588b5a69f7d0941de09b50fa28c (patch) | |
tree | db7cd93c99583a858ef94b3dab95b882832da251 /py/objfloat.c | |
parent | cdd2c62e07549e36dba00bc37d7ba7a4cd41ad50 (diff) | |
parent | c1d9bbc3453454aceb28f51e72e4aeb8ef1c12eb (diff) |
Merge pull request #238 from pfalcon/bool_len
Implement __bool__ and __len__ via unary_op virtual method for all types.
Diffstat (limited to 'py/objfloat.c')
-rw-r--r-- | py/objfloat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/objfloat.c b/py/objfloat.c index 69fd65e19..9caeaf768 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -47,7 +47,7 @@ static mp_obj_t float_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m static mp_obj_t float_unary_op(int op, mp_obj_t o_in) { mp_obj_float_t *o = o_in; switch (op) { - case RT_UNARY_OP_NOT: if (o->value != 0) { return mp_const_true;} else { return mp_const_false; } + case RT_UNARY_OP_BOOL: return MP_BOOL(o->value != 0); case RT_UNARY_OP_POSITIVE: return o_in; case RT_UNARY_OP_NEGATIVE: return mp_obj_new_float(-o->value); default: return NULL; // op not supported |