From d6b43eb17e76dd23894d05863bf85aa7010a9470 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 24 Aug 2012 07:41:54 +0200 Subject: [PATCH] show 'no inc/dec in Python' warning only for ++ and --, not for ~~ --- Cython/Compiler/ExprNodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 46942c1..6747e97 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -7291,8 +7291,8 @@ def unop_node(pos, operator, operand): # given operator. if isinstance(operand, IntNode) and operator == '-': return IntNode(pos = operand.pos, value = str(-Utils.str_to_number(operand.value))) - elif isinstance(operand, UnopNode) and operand.operator == operator: - warning(pos, "Python has no increment/decrement operator: %s%sx = %s(%sx) = x" % ((operator,)*4), 5) + elif isinstance(operand, UnopNode) and operand.operator == operator in '+-': + warning(pos, "Python has no increment/decrement operator: %s%sx == %s(%sx) == x" % ((operator,)*4), 5) return unop_node_classes[operator](pos, operator = operator, operand = operand) -- 2.7.4