Commit bb8d6907 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix c++ error when using 'is' with different types.

parent e786cf6f
...@@ -2909,12 +2909,16 @@ class CmpNode: ...@@ -2909,12 +2909,16 @@ class CmpNode:
richcmp_constants[op], richcmp_constants[op],
code.error_goto_if_null(result_code, self.pos))) code.error_goto_if_null(result_code, self.pos)))
else: 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);" % ( code.putln("%s = %s(%s %s %s);" % (
result_code, result_code,
coerce_result, coerce_result,
operand1.result_code, res1,
self.c_operator(op), self.c_operator(op),
operand2.result_code)) res2))
def c_operator(self, op): def c_operator(self, op):
if op == 'is': if op == 'is':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment