diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-27 23:15:32 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-27 23:15:32 +0000 |
commit | 4e8dc8c41b6f68269571fe218f7292fc86cf3ddb (patch) | |
tree | 535eb325a69877eae7caba92d30fd0da5640fff7 /py/runtime.c | |
parent | addf60b2e6176d8cce23c5608dee10ce196db94b (diff) | |
download | micropython-4e8dc8c41b6f68269571fe218f7292fc86cf3ddb.tar.gz micropython-4e8dc8c41b6f68269571fe218f7292fc86cf3ddb.zip |
py: Add unary op not for NoneType, bool, tuple, list, dict; fix for int.
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c index 8ad98d5f12..ba80480ae0 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -481,7 +481,7 @@ mp_obj_t rt_unary_op(int op, mp_obj_t arg) { if (MP_OBJ_IS_SMALL_INT(arg)) { mp_small_int_t val = MP_OBJ_SMALL_INT_VALUE(arg); switch (op) { - case RT_UNARY_OP_NOT: if (val != 0) { return mp_const_true;} else { return mp_const_false; } + case RT_UNARY_OP_NOT: if (val == 0) { return mp_const_true;} else { return mp_const_false; } case RT_UNARY_OP_POSITIVE: break; case RT_UNARY_OP_NEGATIVE: val = -val; break; case RT_UNARY_OP_INVERT: val = ~val; break; |