From: Robert Bradshaw Date: Wed, 31 Oct 2012 18:56:16 +0000 (-0700) Subject: Swap args for lhs const overflow check. X-Git-Tag: 0.18b1~190 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d002e2b651f0823b1f255f6e00441063a50a849f;p=platform%2Fupstream%2Fpython-cython.git Swap args for lhs const overflow check. --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 031811f..31de95c 100755 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -8011,7 +8011,13 @@ class NumBinopNode(BinopNode): return if self.type.is_complex: self.infix = False - if self.type.is_int and env.directives['overflowcheck'] and self.operator in self.overflow_op_names: + if (self.type.is_int + and env.directives['overflowcheck'] + and self.operator in self.overflow_op_names): + if (self.operator in ('+', '*') + and self.operand1.has_constant_result() + and not self.operand2.has_constant_result()): + self.operand1, self.operand2 = self.operand2, self.operand1 self.overflow_check = True self.func = self.type.overflow_check_binop( self.overflow_op_names[self.operator],