Commit 30496991 authored by Stefan Behnel's avatar Stefan Behnel

Avoid comparing arbitrary type string representations for equality and instead...

Avoid comparing arbitrary type string representations for equality and instead check for the correct instance type first.
parent 84e47269
......@@ -1508,11 +1508,11 @@ class PythranExpr(CType):
def __eq__(self, other):
"""Equality operation for PythranExpr using the str representation"""
return str(self) == str(other)
return isinstance(other, PythranExpr) and self.pythran_type == other.pythran_type
def __hash__(self):
"""Hash function using the str representation"""
return hash(str(self))
return hash(self.pythran_type)
class CConstType(BaseType):
......
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