remember constant values during new constant node creation
authorStefan Behnel <scoder@users.berlios.de>
Thu, 27 May 2010 16:19:34 +0000 (18:19 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 27 May 2010 16:19:34 +0000 (18:19 +0200)
Cython/Compiler/ExprNodes.py

index b2f3dfea63888b85c6ef8c9d094a3be7f80b85d6..4f0129fac6e5b688a506037236435fdb7bf0219f 100755 (executable)
@@ -799,8 +799,9 @@ class IntNode(ConstNode):
         if self.type is dst_type:
             return self
         elif dst_type.is_float:
-            return FloatNode(self.pos, value=repr(float(self.value)))
-        node = IntNode(self.pos, value=self.value,
+            float_value = float(self.value)
+            return FloatNode(self.pos, value=repr(float_value), constant_result=float_value)
+        node = IntNode(self.pos, value=self.value, constant_result=self.constant_result,
                        unsigned=self.unsigned, longness=self.longness)
         if dst_type.is_numeric and not dst_type.is_complex:
             return node