Commit 5fcfa5a1 authored by gsamain's avatar gsamain Committed by Xavier Thompson

Cypclass is and is not

parent 44ecf658
...@@ -12822,7 +12822,9 @@ class PrimaryCmpNode(ExprNode, CmpNode): ...@@ -12822,7 +12822,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": if self.operator in ("is", "is_not")\
and (type1.is_ptr or type1.is_cyp_class)\
and (type2.is_ptr or type2.is_cyp_class):
self.type = PyrexTypes.c_bint_type self.type = PyrexTypes.c_bint_type
return return
error(self.pos, "Invalid types for '%s' (%s, %s)" % error(self.pos, "Invalid types for '%s' (%s, %s)" %
...@@ -12918,7 +12920,7 @@ class PrimaryCmpNode(ExprNode, CmpNode): ...@@ -12918,7 +12920,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 and self.operator != "is": if operand1.type.is_cyp_class and self.operator not in ("is", "is_not"):
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