smarter type analysis in BinopNode: propagate known Python result types
authorStefan Behnel <scoder@users.berlios.de>
Fri, 12 Feb 2010 18:04:24 +0000 (19:04 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 12 Feb 2010 18:04:24 +0000 (19:04 +0100)
Cython/Compiler/ExprNodes.py

index 7be86a8d224c8b886a4ec673dbbd62c6fef25584..a6b52f7d59dc6107b15c50e3d5c43a1e35485f2d 100755 (executable)
@@ -4706,7 +4706,9 @@ class BinopNode(ExprNode):
         self.operand2.analyse_types(env)
         if self.is_py_operation():
             self.coerce_operands_to_pyobjects(env)
-            self.type = py_object_type
+            self.type = self.result_type(self.operand1.type,
+                                         self.operand2.type)
+            assert self.type.is_pyobject
             self.is_temp = 1
         elif self.is_cpp_operation():
             self.analyse_cpp_operation(env)