Add __hash__() and __eq__() to MemoryViewSliceType to avoid distinct object id hashes resulting in duplicate utility code in specialization
Add __hash__() and __eq__() to MemoryViewSliceType to avoid distinct
object id hashes resulting in duplicate utility code in specialization

The CppClassType.specialize() method uses a hash table to avoid
re-generating specializations and thus, for example, re-generating utility code:

    # values is a dict where values are instances of classes in
    # PyrexTypes.py
    key = tuple(values.items())
    if key in self.specializations:
        return self.specializations[key]
    # instantiate new CppClassType, eventually resulting in utility code

However, because MemoryViewSliceType used the default (object-id) hash,
distinct MemoryViewSliceType instances would ultimately give rise to
distinct keys. As a result, code like

     def test_memviews_same(a,b):
         cdef vector[double[:]] aa = a
         cdef vector[double[:]] bb = b

would successfully pass through the Cython compiler but then result in a
C++ compiler error due to redefinition of utility code:

    error: redefinition of 'std::vector<__Pyx_memviewslice> __pyx_convert_vector_from_py___Pyx_memviewslice(PyObject*)'

To allow the hash table in CppClassType.specialize() to identify 'equal'
specializations of CppClassType, we can add __hash__() and __eq__()
methods based on the existing
MemoryViewSliceType.same_as_resolved_type() method. Other classes in
PyrexTypes.py also have __hash__() methods defined and the choices made
here appear roughly consistent.

This addition allows the above example to compile successfully.

c-blake/cython,marscher/cython,roxyboy/cython,acrispin/cython,c-blake/cython,c-blake/cython,acrispin/cython,mcanthony/cython,slonik-az/cython,acrispin/cython,hickford/cython,slonik-az/cython,mrGeen/cython,cython/cython,dahebolangkuan/cython,cython/cython,encukou/cython,ABcDexter/cython,mrGeen/cython,ChristopherHogan/cython,ChristopherHogan/cython,hickford/cython,hickford/cython,scoder/cython,fperez/cython,ABcDexter/cython,mrGeen/cython,scoder/cython,scoder/cython,JelleZijlstra/cython,da-woods/cython,JelleZijlstra/cython,roxyboy/cython,marscher/cython,roxyboy/cython,hhsprings/cython,dahebolangkuan/cython,hhsprings/cython,fabianrost84/cython,roxyboy/cython,fperez/cython,andreasvc/cython,hhsprings/cython,fabianrost84/cython,mcanthony/cython,achernet/cython,madjar/cython,andreasvc/cython,hhsprings/cython,roxyboy/cython,mrGeen/cython,encukou/cython,achernet/cython,ABcDexter/cython,fperez/cython,ABcDexter/cython,cython/cython,mcanthony/cython,dahebolangkuan/cython,andreasvc/cython,ChristopherHogan/cython,marscher/cython,JelleZijlstra/cython,fabianrost84/cython,slonik-az/cython,fperez/cython,acrispin/cython,ABcDexter/cython,hickford/cython,encukou/cython,fperez/cython,achernet/cython,andreasvc/cython,achernet/cython,madjar/cython,andreasvc/cython,slonik-az/cython,cython/cython,encukou/cython,da-woods/cython,fabianrost84/cython,achernet/cython,dahebolangkuan/cython,slonik-az/cython,scoder/cython,hhsprings/cython,JelleZijlstra/cython,acrispin/cython,madjar/cython,dahebolangkuan/cython,madjar/cython,c-blake/cython,JelleZijlstra/cython,madjar/cython,da-woods/cython,mcanthony/cython,marscher/cython,mrGeen/cython,da-woods/cython,mcanthony/cython,hickford/cython,encukou/cython,fabianrost84/cython,marscher/cython,c-blake/cython