summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2017-10-28 17:29:41 +0200
committerStefan Behnel <stefan_ml@behnel.de>2017-10-28 17:29:41 +0200
commit304969913fa33dc247e8e0f15bece7dc25fd7c33 (patch)
treec817785fa97d691c6ca473799f3103d11f2590d6
parent84e47269c69ea64dba3f400818c577efd942657a (diff)
downloadcython-304969913fa33dc247e8e0f15bece7dc25fd7c33.tar.gz
Avoid comparing arbitrary type string representations for equality and instead check for the correct instance type first.
-rw-r--r--Cython/Compiler/PyrexTypes.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Cython/Compiler/PyrexTypes.py b/Cython/Compiler/PyrexTypes.py
index 572e25ee7..bdfd6b287 100644
--- a/Cython/Compiler/PyrexTypes.py
+++ b/Cython/Compiler/PyrexTypes.py
@@ -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):