Use assignable_from for conditional node
authorRobert Bradshaw <robertwb@math.washington.edu>
Tue, 25 Sep 2007 21:47:12 +0000 (14:47 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Tue, 25 Sep 2007 21:47:12 +0000 (14:47 -0700)
Fixes

cdef int a, b
cdef int *foo = &a if a else &b

Cython/Compiler/ExprNodes.py

index aa147d11ab966c46f1cd837e023bd4d0e5810135..06067b5f79912eeff55babe38ab15f2025006865 100644 (file)
@@ -2805,6 +2805,10 @@ class CondExprNode(ExprNode):
             return type1
         elif type1.is_pyobject or type2.is_pyobject:
             return py_object_type
+        elif type1.assignable_from(type2):
+            return type1
+        elif type2.assignable_from(type1):
+            return type2
         else:
             return None