Commit 6f9ebe40 authored by gsamain's avatar gsamain

Allow is statement for cypclass (pointer comparison as with PyObjects)

parent d4a39839
...@@ -12722,6 +12722,9 @@ class PrimaryCmpNode(ExprNode, CmpNode): ...@@ -12722,6 +12722,9 @@ class PrimaryCmpNode(ExprNode, CmpNode):
self.is_pycmp = False self.is_pycmp = False
entry = env.lookup_operator(self.operator, [self.operand1, self.operand2]) entry = env.lookup_operator(self.operator, [self.operand1, self.operand2])
if entry is None: if entry is None:
if self.operator == "is":
self.type = PyrexTypes.c_bint_type
return
error(self.pos, "Invalid types for '%s' (%s, %s)" % error(self.pos, "Invalid types for '%s' (%s, %s)" %
(self.operator, type1, type2)) (self.operator, type1, type2))
self.type = PyrexTypes.error_type self.type = PyrexTypes.error_type
...@@ -12815,7 +12818,7 @@ class PrimaryCmpNode(ExprNode, CmpNode): ...@@ -12815,7 +12818,7 @@ class PrimaryCmpNode(ExprNode, CmpNode):
result1, result2 = operand1.pythran_result(), operand2.pythran_result() result1, result2 = operand1.pythran_result(), operand2.pythran_result()
else: else:
result1, result2 = operand1.result(), operand2.result() result1, result2 = operand1.result(), operand2.result()
if operand1.type.is_cyp_class: if operand1.type.is_cyp_class and self.operator != "is":
result1 = '*' + result1 result1 = '*' + result1
if self.is_memslice_nonecheck: if self.is_memslice_nonecheck:
if operand1.type.is_memoryviewslice: if operand1.type.is_memoryviewslice:
......
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