From: Stefan Behnel Date: Thu, 15 May 2008 09:19:23 +0000 (+0200) Subject: range optimisation fixes X-Git-Tag: 0.9.8rc1~37^2~41^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d467013cb4c4f651ef5265519959f1aa7a6ec9d0;p=cython.git range optimisation fixes --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 352ee77e..dc42009d 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2990,15 +2990,16 @@ class ForInStatNode(LoopNode, StatNode): else: step = args[2] if isinstance(step, ExprNodes.UnaryMinusNode) and isinstance(step.operand, ExprNodes.IntNode): - step = ExprNodes.IntNode(pos = step.pos, value=-int(step.operand.value)) + step = ExprNodes.IntNode(pos = step.pos, value=str(-int(step.operand.value, 0))) if isinstance(step, ExprNodes.IntNode): - if step.value > 0: + step_value = int(step.value, 0) + if step_value > 0: self.step = step self.relation1 = '<=' self.relation2 = '<' return True - elif step.value < 0: - self.step = ExprNodes.IntNode(pos = step.pos, value=-int(step.value)) + elif step_value < 0: + self.step = ExprNodes.IntNode(pos = step.pos, value=str(-step_value)) self.relation1 = '>=' self.relation2 = '>' return True