Commit 58788692 authored by Stefan Behnel's avatar Stefan Behnel

fix hashing of CPtrType in Py3k

parent 8b287aa9
......@@ -2161,9 +2161,6 @@ class CPointerBaseType(CType):
self.from_py_function = "__Pyx_PyBytes_AsUString"
self.exception_value = "NULL"
def __hash__(self):
return hash(self.base_type) + self.is_ptr + 27 # arbitrarily chosen offset
def py_type_name(self):
if self.is_string:
return "bytes"
......@@ -2187,11 +2184,13 @@ class CArrayType(CPointerBaseType):
self.size = size
def __eq__(self, other):
if isinstance(other, CType):
if self.is_array and other.is_array and self.size == other.size:
return self.base_type.same_as(other.base_type)
if isinstance(other, CType) and other.is_array and self.size == other.size:
return self.base_type.same_as(other.base_type)
return False
def __hash__(self):
return hash(self.base_type) + 28 # arbitrarily chosen offset
def __repr__(self):
return "<CArrayType %s %s>" % (self.size, repr(self.base_type))
......@@ -2232,6 +2231,9 @@ class CPtrType(CPointerBaseType):
is_ptr = 1
default_value = "0"
def __hash__(self):
return hash(self.base_type) + 27 # arbitrarily chosen offset
def __eq__(self, other):
if isinstance(other, CType) and other.is_ptr:
return self.base_type.same_as(other.base_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