From 4e8dc8c41b6f68269571fe218f7292fc86cf3ddb Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 27 Jan 2014 23:15:32 +0000 Subject: py: Add unary op not for NoneType, bool, tuple, list, dict; fix for int. --- py/runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/runtime.c') 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; -- cgit v1.2.3