Commit 3a57260e authored by Stefan Behnel's avatar Stefan Behnel

Looks like Py2 requires "__ne__()" in addition to "__eq__()" for a correct implementation.

parent fe94b2f5
...@@ -1471,6 +1471,7 @@ class CType(PyrexType): ...@@ -1471,6 +1471,7 @@ class CType(PyrexType):
source_code, source_code,
code.error_goto_if(error_condition or self.error_condition(result_code), error_pos)) code.error_goto_if(error_condition or self.error_condition(result_code), error_pos))
class PythranExpr(CType): class PythranExpr(CType):
# Pythran object of a given type # Pythran object of a given type
...@@ -1510,6 +1511,10 @@ class PythranExpr(CType): ...@@ -1510,6 +1511,10 @@ class PythranExpr(CType):
"""Equality operation for PythranExpr using the str representation""" """Equality operation for PythranExpr using the str representation"""
return isinstance(other, PythranExpr) and self.pythran_type == other.pythran_type return isinstance(other, PythranExpr) and self.pythran_type == other.pythran_type
def __ne__(self, other):
"""Equality operation for PythranExpr using the str representation"""
return not isinstance(other, PythranExpr) or self.pythran_type != other.pythran_type
def __hash__(self): def __hash__(self):
"""Hash function using the str representation""" """Hash function using the str representation"""
return hash(self.pythran_type) return hash(self.pythran_type)
......
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