Fix c++ error when using 'is' with different types.
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 10 Oct 2007 09:46:46 +0000 (02:46 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 10 Oct 2007 09:46:46 +0000 (02:46 -0700)
Cython/Compiler/ExprNodes.py

index 4d93dfa0966533d4740ca92e54b32881116091b2..ac3656f7edcffd5017880ab7f66f1fcfcfffde2e 100644 (file)
@@ -2909,12 +2909,16 @@ class CmpNode:
                         richcmp_constants[op],
                         code.error_goto_if_null(result_code, self.pos)))
         else:
+            if operand1.type.is_pyobject:
+                res1, res2 = operand1.py_result(), operand2.py_result()
+            else:
+                res1, res2 = operand1.result_code, operand2.result_code
             code.putln("%s = %s(%s %s %s);" % (
                 result_code, 
                 coerce_result, 
-                operand1.result_code
+                res1
                 self.c_operator(op), 
-                operand2.result_code))
+                res2))
     
     def c_operator(self, op):
         if op == 'is':